1'use strict'; 2/*! 3 * Copyright (c) Anaconda, Inc., and Bokeh Contributors 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without modification, 7 * are permitted provided that the following conditions are met: 8 * 9 * Redistributions of source code must retain the above copyright notice, 10 * this list of conditions and the following disclaimer. 11 * 12 * Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 16 * Neither the name of Anaconda nor the names of any contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32(function(root, factory) { 33 factory(root["Bokeh"], "3.10.0"); 34})(this, function(Bokeh, version) { 35 let define; 36 return (function(modules, entry, aliases, externals) { 37 const bokeh = typeof Bokeh !== "undefined" ? (version != null ? Bokeh[version] : Bokeh) : null; 38 if (bokeh != null) { 39 return bokeh.register_plugin(modules, entry, aliases); 40 } else { 41 throw new Error("Cannot find Bokeh" + (version != null ? " " + version : "") + ". You have to load it prior to loading plugins."); 42 } 43 }) 44({ 45639: function _(n,c,f,i,o){i(),n(640)}, 46640: function _(t,r,e,o,a){o();const p=t(1);a("get_regl",t(641).get_regl),p.__exportStar(t(655),e),p.__exportStar(t(662),e),p.__exportStar(t(663),e),p.__exportStar(t(658),e),p.__exportStar(t(664),e),p.__exportStar(t(666),e),p.__exportStar(t(667),e),p.__exportStar(t(668),e),p.__exportStar(t(670),e),p.__exportStar(t(671),e),p.__exportStar(t(672),e),p.__exportStar(t(675),e),p.__exportStar(t(676),e),p.__exportStar(t(677),e),p.__exportStar(t(678),e),p.__exportStar(t(669),e),p.__exportStar(t(657),e),p.__exportStar(t(679),e),p.__exportStar(t(680),e)}, 47641: function _(e,t,i,n,r){n(),i.get_regl=function(e){null==v&&(v=new ReglWrapper(e));return v};const a=e(1),o=a.__importDefault(e(642)),s=e(643),l=a.__importDefault(e(645)),f=a.__importDefault(e(646)),p=a.__importDefault(e(647)),c=a.__importDefault(e(648)),u=a.__importDefault(e(649)),h=a.__importDefault(e(650)),g=a.__importDefault(e(651)),m=a.__importDefault(e(652)),d=a.__importDefault(e(653)),b=a.__importDefault(e(654));let v=null;class ReglWrapper{_regl;_regl_available;_dash_cache;_accumulate;_image;_solid_line;_dashed_line;_polygon;_polygon_hatch;_marker_no_hatch_map=new Map;_marker_hatch_map=new Map;_line_geometry;_line_triangles;_rect_geometry;_rect_triangles;_scissor;_viewport;_framebuffer;_framebuffer_texture;constructor(e){try{this._regl=(0,o.default)({gl:e,extensions:["ANGLE_instanced_arrays","EXT_blend_minmax","OES_element_index_uint"]}),this._regl_available=!0,this._line_geometry=this._regl.buffer({usage:"static",type:"float",data:[[-2,0],[-1,-1],[1,-1],[1,1],[-1,1]]}),this._line_triangles=this._regl.elements({usage:"static",primitive:"triangle fan",data:[0,1,2,3,4]}),this._rect_geometry=this._regl.buffer({usage:"static",type:"float",data:[[-1,-1],[1,-1],[1,1],[-1,1]]}),this._rect_triangles=this._regl.elements({usage:"static",primitive:"triangle fan",data:[0,1,2,3]})}catch(e){this._regl_available=!1}}buffer(e){return this._regl.buffer(e)}elements(e){return this._regl.elements(e)}clear(e,t){this._viewport={x:0,y:0,width:e,height:t},this._regl.clear({color:[0,0,0,0]})}clear_framebuffer(e){this._regl.clear({color:[0,0,0,0],framebuffer:e})}get framebuffer_and_texture(){const{_regl:e}=this,{_gl:t}=e,i={height:t.drawingBufferHeight,width:t.drawingBufferWidth};return null==this._framebuffer_texture?this._framebuffer_texture=e.texture(i):this._framebuffer_texture(i),null==this._framebuffer&&(this._framebuffer=e.framebuffer({color:this._framebuffer_texture,depth:!1,stencil:!1})),[this._framebuffer,this._framebuffer_texture]}get has_webgl(){return this._regl_available}get scissor(){return this._scissor}set_scissor(e,t,i,n){this._scissor={x:e,y:t,width:i,height:n}}texture(e){return this._regl.texture(e)}get viewport(){return this._viewport}accumulate(){return null==this._accumulate&&(this._accumulate=function(e,t,i){const n={vert:l.default,frag:f.default,attributes:{a_position:{buffer:t,divisor:0}},uniforms:{u_framebuffer_tex:e.prop("framebuffer_tex")},elements:i,blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},scissor:{enable:!0,box:e.prop("scissor")},viewport:e.prop("viewport")};return e(n)}(this._regl,this._rect_geometry,this._rect_triangles)),this._accumulate}dashed_line(){return null==this._dashed_line&&(this._dashed_line=function(e,t,i){const n={vert:`#define DASHED\n${u.default}\n`,frag:`#define DASHED\n${h.default}\n`,attributes:{a_position:{buffer:t,divisor:0},a_point_prev:(e,t)=>
47t.points.to_attribute_config(t.point_offset),a_point_start:(e,t)=>t.points.to_attribute_config(t.point_offset+2),a_point_end:(e,t)=>t.points.to_attribute_config(t.point_offset+4),a_point_next:(e,t)=>t.points.to_attribute_config(t.point_offset+6),a_show_prev:(e,t)=>t.show.to_attribute_config(t.point_offset/2-t.line_offset),a_show_curr:(e,t)=>t.show.to_attribute_config(t.point_offset/2-t.line_offset+1),a_show_next:(e,t)=>t.show.to_attribute_config(t.point_offset/2-t.line_offset+2),a_linewidth:(e,t)=>t.linewidth.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_line_color:(e,t)=>t.line_color.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_line_cap:(e,t)=>t.line_cap.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_line_join:(e,t)=>t.line_join.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_length_so_far:(e,t)=>t.length_so_far.to_attribute_config(t.point_offset/2-3*t.line_offset),a_dash_tex_info:(e,t)=>t.dash_tex_info.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_dash_scale:(e,t)=>t.dash_scale.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_dash_offset:(e,t)=>t.dash_offset.to_attribute_config_nested(t.line_offset,t.nsegments+3)},uniforms:{u_canvas_size:e.prop("canvas_size"),u_antialias:e.prop("antialias"),u_miter_limit:e.prop("miter_limit"),u_dash_tex:e.prop("dash_tex")},elements:i,instances:e.prop("nsegments"),blend:{enable:!0,equation:"max",func:{srcRGB:1,srcAlpha:1,dstRGB:1,dstAlpha:1}},depth:{enable:!1},framebuffer:e.prop("framebuffer"),scissor:{enable:!0,box:e.prop("scissor")},viewport:e.prop("viewport")};return e(n)}(this._regl,this._line_geometry,this._line_triangles)),this._dashed_line}get_dash(e){return null==this._dash_cache&&(this._dash_cache=new s.DashCache(this._regl)),this._dash_cache.get(e)}image(){return null==this._image&&(this._image=function(e,t,i){const n={vert:p.default,frag:c.default,attributes:{a_position:{buffer:t,divisor:0},a_bounds:(e,t)=>t.bounds.to_attribute_config()},uniforms:{u_canvas_size:e.prop("canvas_size"),u_tex:e.prop("tex"),u_global_alpha:e.prop("global_alpha")},elements:i,blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},scissor:{enable:!0,box:e.prop("scissor")},viewport:e.prop("viewport")};return e(n)}(this._regl,this._rect_geometry,this._rect_triangles)),this._image}polygon(){return null==this._polygon&&(this._polygon=function(e){const t={vert:d.default,frag:b.default,attributes:{a_position:(e,t)=>t.positions.to_per_vertex_config(),a_fill_color:(e,t)=>t.fill_color.to_per_vertex_config(),a_edge_distance:(e,t)=>t.edge_distance.to_per_vertex_config()},uniforms:{u_canvas_size:e.prop("canvas_size"),u_antialias:e.prop("antialias")},elements:e.prop("elements"),count:e.prop("count"),offset:e.prop("offset"),blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},scissor:{enable:!0,box:e.prop("scissor")},viewport:e.prop("viewport")};return e(t)}(this._regl)),this._polygon}polygon_hatch(){return null==this._polygon_hatch&&(this._polygon_hatch=function(e){const t={vert:`#define HATCH\n${d.default}\n`,frag:`#define HATCH\n${b.default}\n`,attributes:{a_position:(e,t)=>t.positions.to_per_vertex_config(),a_fill_color:(e,t)=>t.fill_color.to_per_vertex_config(),a_edge_distance:(e,t)=>t.edge_distance.to_per_vertex_config(),a_hatch_pattern:(e,t)=>t.hatch_pattern.to_per_vertex_config(),a_hatch_scale:(e,t)=>t.hatch_scale.to_per_vertex_config(),a_hatch_weight:(e,t)=>t.hatch_weight.to_per_vertex_config(),a_hatch_color:(e,t)=>t.hatch_color.to_per_vertex_config()},uniforms:{u_canvas_size:e.prop("canvas_size"),u_antialias:e.prop("antialias")},elements:e.prop("elements"),count:e.prop("count"),offset:e.prop("offset"),blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},scissor:{enable:!0,box:e.prop("scissor")},viewport:e.prop("viewport")};return e(t)}(this._regl)),this._polygon_hatch}marker_no_hatch(e){let t=this._marker_no_hatch_map.get(e);return null==t&&(t=w(this._regl,e),this._marker_no_hatch_map.set(e,t)),t}marker_hatch(e){let t=this._marker_hatch_map.get(e);return null==t&&(t=function(e,t){return w(e,t,["HATCH"],["HATCH"],{a_hatch_pattern:(e,t)=>t.hatch_pattern.to_attribute_config(0,t.nmarkers),a_hatch_scale:(e,t)=>
47t.hatch_scale.to_attribute_config(0,t.nmarkers),a_hatch_weight:(e,t)=>t.hatch_weight.to_attribute_config(0,t.nmarkers),a_hatch_color:(e,t)=>t.hatch_color.to_attribute_config(0,t.nmarkers)})}(this._regl,e),this._marker_hatch_map.set(e,t)),t}solid_line(){return null==this._solid_line&&(this._solid_line=function(e,t,i){const n={vert:u.default,frag:h.default,attributes:{a_position:{buffer:t,divisor:0},a_point_prev:(e,t)=>t.points.to_attribute_config(t.point_offset),a_point_start:(e,t)=>t.points.to_attribute_config(t.point_offset+2),a_point_end:(e,t)=>t.points.to_attribute_config(t.point_offset+4),a_point_next:(e,t)=>t.points.to_attribute_config(t.point_offset+6),a_show_prev:(e,t)=>t.show.to_attribute_config(t.point_offset/2-t.line_offset),a_show_curr:(e,t)=>t.show.to_attribute_config(t.point_offset/2-t.line_offset+1),a_show_next:(e,t)=>t.show.to_attribute_config(t.point_offset/2-t.line_offset+2),a_linewidth:(e,t)=>t.linewidth.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_line_color:(e,t)=>t.line_color.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_line_cap:(e,t)=>t.line_cap.to_attribute_config_nested(t.line_offset,t.nsegments+3),a_line_join:(e,t)=>t.line_join.to_attribute_config_nested(t.line_offset,t.nsegments+3)},uniforms:{u_canvas_size:e.prop("canvas_size"),u_antialias:e.prop("antialias"),u_miter_limit:e.prop("miter_limit")},elements:i,instances:e.prop("nsegments"),blend:{enable:!0,equation:"max",func:{srcRGB:1,srcAlpha:1,dstRGB:1,dstAlpha:1}},depth:{enable:!1},framebuffer:e.prop("framebuffer"),scissor:{enable:!0,box:e.prop("scissor")},viewport:e.prop("viewport")};return e(n)}(this._regl,this._line_geometry,this._line_triangles)),this._solid_line}}function w(e,t,i=[],n=[],r){const a=i.map(e=>`#define ${e}`).join("\n"),o=n.map(e=>`#define ${e}`).join("\n"),s={vert:`${a}\n#define MULTI_MARKER\n#define USE_${t.toUpperCase()}\n${g.default}\n`,frag:`${o}\n#define USE_${t.toUpperCase()}\n${m.default}\n`,attributes:{a_position:{buffer:e.buffer([[-.5,-.5],[-.5,.5],[.5,.5],[.5,-.5]]),divisor:0},a_center:(e,t)=>t.center.to_attribute_config(0,t.nmarkers),a_width:(e,t)=>t.width.to_attribute_config(0,t.nmarkers),a_height:(e,t)=>t.height.to_attribute_config(0,t.nmarkers),a_angle:(e,t)=>t.angle.to_attribute_config(0,t.nmarkers),a_aux:(e,t)=>t.aux.to_attribute_config(0,t.nmarkers),a_linewidth:(e,t)=>t.linewidth.to_attribute_config(0,t.nmarkers),a_line_color:(e,t)=>t.line_color.to_attribute_config(0,t.nmarkers),a_fill_color:(e,t)=>t.fill_color.to_attribute_config(0,t.nmarkers),a_line_cap:(e,t)=>t.line_cap.to_attribute_config(0,t.nmarkers),a_line_join:(e,t)=>t.line_join.to_attribute_config(0,t.nmarkers),a_show:(e,t)=>t.show.to_attribute_config(0,t.nmarkers),...r},uniforms:{u_canvas_size:e.prop("canvas_size"),u_antialias:e.prop("antialias"),u_size_hint:e.prop("size_hint"),u_border_radius:e.prop("border_radius")},count:4,primitive:"triangle fan",instances:e.prop("nmarkers"),blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},scissor:{enable:!0,box:e.prop("scissor")},viewport:e.prop("viewport")};return e(s)}i.ReglWrapper=ReglWrapper}, 48642: function _(e,t,r,n,a){var i,o;i=this,o=function(){"use strict";var e=function(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array||e instanceof Uint8ClampedArray},t=function(e,t){for(var r=Object.keys(t),n=0;n<r.length;++n)e[r[n]]=t[r[n]];return e},r="\n";function n(e){return"undefined"!=typeof atob?atob(e):"base64:"+e}function a(e){var t=new Error("(regl) "+e);throw console.error(t),t}function i(e,t){e||a(t)}function o(e){return e?": "+e:""}function f(e,t){switch(t){case"number":return"number"==typeof e;case"object":return"object"==typeof e;case"string":return"string"==typeof e;case"boolean":return"boolean"==typeof e;case"function":return"function"==typeof e;case"undefined":return void 0===e;case"symbol":return"symbol"==typeof e}}function u(e,t,r){t.indexOf(e)<0&&a("invalid value"+o(r)+". must be one of: "+t)}var s=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function c(e,t){for(e+="";e.length<t;)e=" "+e;return e}function l(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function d(e,t){this.number=e,this.line=t,this.errors=[]}function m(e,t,r){this.file=e,this.line=t,this.message=r}function p(){var e=new Error,t=(e.stack||e).toString(),r=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(t);if(r)return r[1];var n=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(t);
48return n?n[1]:"unknown"}function h(){var e=new Error,t=(e.stack||e).toString(),r=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(t);if(r)return r[1];var n=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(t);return n?n[1]:"unknown"}function b(e,t){var r=e.split("\n"),a=1,i=0,o={unknown:new l,0:new l};o.unknown.name=o[0].name=t||p(),o.unknown.lines.push(new d(0,""));for(var f=0;f<r.length;++f){var u=r[f],s=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(u);if(s)switch(s[1]){case"line":var c=/(\d+)(\s+\d+)?/.exec(s[2]);c&&(a=0|c[1],c[2]&&((i=0|c[2])in o||(o[i]=new l)));break;case"define":var m=/SHADER_NAME(_B64)?\s+(.*)$/.exec(s[2]);m&&(o[i].name=m[1]?n(m[2]):m[2])}o[i].lines.push(new d(a++,u))}return Object.keys(o).forEach(function(e){var t=o[e];t.lines.forEach(function(e){t.index[e.number]=e})}),o}function v(e){e._commandRef=p()}function g(e,t){var r=h();a(e+" in command "+(t||p())+("unknown"===r?"":" called from "+r))}function y(e,t,r,n){f(e,t)||g("invalid parameter type"+o(r)+". expected "+t+", got "+typeof e,n||p())}var x=33071,w={};function A(e,t){return 32820===e||32819===e||33635===e?2:34042===e?4:w[e]*t}function k(e){return!(e&e-1||!e)}w[5120]=w[5121]=1,w[5122]=w[5123]=w[36193]=w[33635]=w[32819]=w[32820]=2,w[5124]=w[5125]=w[5126]=w[34042]=4;var S=t(i,{optional:function(e){e()},raise:a,commandRaise:g,command:function(e,t,r){e||g(t,r||p())},parameter:function(e,t,r){e in t||a("unknown parameter ("+e+")"+o(r)+". possible values: "+Object.keys(t).join())},commandParameter:function(e,t,r,n){e in t||g("unknown parameter ("+e+")"+o(r)+". possible values: "+Object.keys(t).join(),n||p())},constructor:function(e){Object.keys(e).forEach(function(e){s.indexOf(e)<0&&a('invalid regl constructor argument "'+e+'". must be one of '+s)})},type:function(e,t,r){f(e,t)||a("invalid parameter type"+o(r)+". expected "+t+", got "+typeof e)},commandType:y,isTypedArray:function(t,r){e(t)||a("invalid parameter type"+o(r)+". must be a typed array")},nni:function(e,t){e>=0&&(0|e)===e||a("invalid parameter type, ("+e+")"+o(t)+". must be a nonnegative integer")},oneOf:u,shaderError:function(e,t,n,a,o){if(!e.getShaderParameter(t,e.COMPILE_STATUS)){var f=e.getShaderInfoLog(t),u=a===e.FRAGMENT_SHADER?"fragment":"vertex";y(n,"string",u+" shader source must be a string",o);var s=b(n,o),l=function(e){var t=[];return e.split("\n").forEach(function(e){if(!(e.length<5)){var r=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(e);r?t.push(new m(0|r[1],0|r[2],r[3].trim())):e.length>0&&t.push(new m("unknown",0,e))}}),t}(f);!function(e,t){t.forEach(function(t){var r=e[t.file];if(r){var n=r.index[t.line];if(n)return n.errors.push(t),void(r.hasErrors=!0)}e.unknown.hasErrors=!0,e.unknown.lines[0].errors.push(t)})}(s,l),Object.keys(s).forEach(function(e){var t=s[e];if(t.hasErrors){var n=[""],a=[""];i("file number "+e+": "+t.name+"\n","color:red;text-decoration:underline;font-weight:bold"),t.lines.forEach(function(e){if(e.errors.length>0){i(c(e.number,4)+"| ","background-color:yellow; font-weight:bold"),i(e.line+r,"color:red; background-color:yellow; font-weight:bold");var t=0;e.errors.forEach(function(n){var a=n.message,o=/^\s*'(.*)'\s*:\s*(.*)$/.exec(a);if(o){var f=o[1];a=o[2],"assign"===f&&(f="="),t=Math.max(e.line.indexOf(f,t),0)}else t=0;i(c("| ",6)),i(c("^^^",t+3)+r,"font-weight:bold"),i(c("| ",6)),i(a+r,"font-weight:bold")}),i(c("| ",6)+r)}else i(c(e.number,4)+"| "),i(e.line+r,"color:red")}),"undefined"==typeof document||window.chrome?console.log(n.join("")):(a[0]=n.join("%c"),console.log.apply(console,a))}function i(e,t){n.push(e),a.push(t||"")}}),i.raise("Error compiling "+u+" shader, "+s[0].name)}},linkError:function(e,t,n,a,o){if(!e.getProgramParameter(t,e.LINK_STATUS)){var f=e.getProgramInfoLog(t),u=b(n,o),s='Error linking program with vertex shader, "'+b(a,o)[0].name+'", and fragment shader "'+u[0].name+'"';"undefined"!=typeof document?console.log("%c"+s+"\n%c"+f,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(s+r+f),i.raise(s)}},callSite:h,saveCommandRef:v,saveDrawInfo:function(e,t,r,n){function a(e){return e?n.id(e):0}function i(e,t){Object.keys(t).forEach(function(t){e[n.id(t)]=!0})}v(e),e._fragId=a(e.static.frag),e._vertId=a(e.static.vert);var o=e._uniformSet={};i(o,t.static),i(o,t.dynamic);var f=e._attributeSet={};i(f,r.static),i(f,r.dynamic),e._hasCount="count"in e.static||"count"in e.dynamic||"elements"in e.static||"elements"in e.dynamic},framebufferFormat:function(e,t,r){e.texture?u(e.texture._texture.internalformat,t,"unsupported texture format for attachment"):u(e.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")},guessCommand:p,texture2D:function(e,t,r){var n,a=t.width,o=t.height,f=t.channels;i(a>0&&a<=r.maxTextureSize&&o>
480&&o<=r.maxTextureSize,"invalid texture shape"),e.wrapS===x&&e.wrapT===x||i(k(a)&&k(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===t.mipmask?1!==a&&1!==o&&i(9984!==e.minFilter&&9986!==e.minFilter&&9985!==e.minFilter&&9987!==e.minFilter,"min filter requires mipmap"):(i(k(a)&&k(o),"texture must be a square power of 2 to support mipmapping"),i(t.mipmask===(a<<1)-1,"missing or incomplete mipmap data")),5126===t.type&&(r.extensions.indexOf("oes_texture_float_linear")<0&&i(9728===e.minFilter&&9728===e.magFilter,"filter not supported, must enable oes_texture_float_linear"),i(!e.genMipmaps,"mipmap generation not supported with float textures"));var u=t.images;for(n=0;n<16;++n)if(u[n]){var s=a>>n,c=o>>n;i(t.mipmask&1<<n,"missing mipmap data");var l=u[n];if(i(l.width===s&&l.height===c,"invalid shape for mip images"),i(l.format===t.format&&l.internalformat===t.internalformat&&l.type===t.type,"incompatible type for mip image"),l.compressed);else if(l.data){var d=Math.ceil(A(l.type,f)*s/l.unpackAlignment)*l.unpackAlignment;i(l.data.byteLength===d*c,"invalid data for image, buffer size is inconsistent with image format")}else l.element||l.copy}else e.genMipmaps||i(!(t.mipmask&1<<n),"extra mipmap data");t.compressed&&i(!e.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(e,t,r,n){var a=e.width,o=e.height,f=e.channels;i(a>0&&a<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),i(a===o,"cube map must be square"),i(t.wrapS===x&&t.wrapT===x,"wrap mode not supported by cube map");for(var u=0;u<r.length;++u){var s=r[u];i(s.width===a&&s.height===o,"inconsistent cube map face shape"),t.genMipmaps&&(i(!s.compressed,"can not generate mipmap for compressed textures"),i(1===s.mipmask,"can not specify mipmaps and generate mipmaps"));for(var c=s.images,l=0;l<16;++l){var d=c[l];if(d){var m=a>>l,p=o>>l;i(s.mipmask&1<<l,"missing mipmap data"),i(d.width===m&&d.height===p,"invalid shape for mip images"),i(d.format===e.format&&d.internalformat===e.internalformat&&d.type===e.type,"incompatible type for mip image"),d.compressed||(d.data?i(d.data.byteLength===m*p*Math.max(A(d.type,f),d.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):d.element||d.copy)}}}}}),O=0;function E(e,t){this.id=O++,this.type=e,this.data=t}function T(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function D(e){if(0===e.length)return[];var t=e.charAt(0),r=e.charAt(e.length-1);if(e.length>1&&t===r&&('"'===t||"'"===t))return['"'+T(e.substr(1,e.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(n)return D(e.substr(0,n.index)).concat(D(n[1])).concat(D(e.substr(n.index+n[0].length)));var a=e.split(".");if(1===a.length)return['"'+T(e)+'"'];for(var i=[],o=0;o<a.length;++o)i=i.concat(D(a[o]));return i}function j(e){return"["+D(e).join("][")+"]"}var C={DynamicVariable:E,define:function(e,t){return new E(e,j(t+""))},isDynamic:function(e){return"function"==typeof e&&!e._reglType||e instanceof E},unbox:function e(t,r){return"function"==typeof t?new E(0,t):"number"==typeof t||"boolean"==typeof t?new E(5,t):Array.isArray(t)?new E(6,t.map(function(t,n){return e(t,r+"["+n+"]")})):t instanceof E?t:void S(!1,"invalid option type in uniform "+r)},accessor:j},z={next:"function"==typeof requestAnimationFrame?function(e){return requestAnimationFrame(e)}:function(e){return setTimeout(e,16)},cancel:"function"==typeof cancelAnimationFrame?function(e){return cancelAnimationFrame(e)}:clearTimeout},F="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date};function V(e){return"string"==typeof e?e.split():(S(Array.isArray(e),"invalid extension array"),e)}function B(e){return"string"==typeof e?(S("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(e)):e}function I(e){var r,n,a,i,o,f=e||{},u={},s=[],c=[],l="undefined"==typeof window?1:window.devicePixelRatio,d=!1,m=function(e){e&&S.raise(e)},p=function(){};if("string"==typeof f?(S("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),r=document.querySelector(f),S(r,"invali
48d query string for element")):"object"==typeof f?"string"==typeof(o=f).nodeName&&"function"==typeof o.appendChild&&"function"==typeof o.getBoundingClientRect?r=f:function(e){return"function"==typeof e.drawArrays||"function"==typeof e.drawElements}(f)?a=(i=f).canvas:(S.constructor(f),"gl"in f?i=f.gl:"canvas"in f?a=B(f.canvas):"container"in f&&(n=B(f.container)),"attributes"in f&&(u=f.attributes,S.type(u,"object","invalid context attributes")),"extensions"in f&&(s=V(f.extensions)),"optionalExtensions"in f&&(c=V(f.optionalExtensions)),"onDone"in f&&(S.type(f.onDone,"function","invalid or missing onDone callback"),m=f.onDone),"profile"in f&&(d=!!f.profile),"pixelRatio"in f&&(l=+f.pixelRatio,S(l>0,"invalid pixel ratio"))):S.raise("invalid arguments to regl"),r&&("canvas"===r.nodeName.toLowerCase()?a=r:n=r),!i){if(!a){S("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var h=function(e,r,n){var a,i=document.createElement("canvas");function o(){var t=window.innerWidth,r=window.innerHeight;if(e!==document.body){var a=i.getBoundingClientRect();t=a.right-a.left,r=a.bottom-a.top}i.width=n*t,i.height=n*r}return t(i.style,{border:0,margin:0,padding:0,top:0,left:0,width:"100%",height:"100%"}),e.appendChild(i),e===document.body&&(i.style.position="absolute",t(e.style,{margin:0,padding:0})),e!==document.body&&"function"==typeof ResizeObserver?(a=new ResizeObserver(function(){setTimeout(o)})).observe(e):window.addEventListener("resize",o,!1),o(),{canvas:i,onDestroy:function(){a?a.disconnect():window.removeEventListener("resize",o),e.removeChild(i)}}}(n||document.body,0,l);if(!h)return null;a=h.canvas,p=h.onDestroy}void 0===u.premultipliedAlpha&&(u.premultipliedAlpha=!0),i=function(e,t){function r(r){try{return e.getContext(r,t)}catch(e){return null}}return r("webgl")||r("experimental-webgl")||r("webgl-experimental")}(a,u)}return i?{gl:i,canvas:a,container:n,extensions:s,optionalExtensions:c,pixelRatio:l,profile:d,onDone:m,onDestroy:p}:(p(),m("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function P(e,t){for(var r=Array(e),n=0;n<e;++n)r[n]=t(n);return r}function L(e){var t,r;return t=(e>65535)<<4,t|=r=((e>>>=t)>255)<<3,t|=r=((e>>>=r)>15)<<2,(t|=r=((e>>>=r)>3)<<1)|(e>>>=r)>>1}function R(){var e=P(8,function(){return[]});function t(t){var r=function(e){for(var t=16;t<=1<<28;t*=16)if(e<=t)return t;return 0}(t),n=e[L(r)>>2];return n.length>0?n.pop():new ArrayBuffer(r)}function r(t){e[L(t.byteLength)>>2].push(t)}return{alloc:t,free:r,allocType:function(e,r){var n=null;switch(e){case 5120:n=new Int8Array(t(r),0,r);break;case 5121:n=new Uint8Array(t(r),0,r);break;case 5122:n=new Int16Array(t(2*r),0,r);break;case 5123:n=new Uint16Array(t(2*r),0,r);break;case 5124:n=new Int32Array(t(4*r),0,r);break;case 5125:n=new Uint32Array(t(4*r),0,r);break;case 5126:n=new Float32Array(t(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(e){r(e.buffer)}}}var M=R();M.zero=R();var U=3553,W=6408,G=5126,H=36160;function N(t){return!!t&&"object"==typeof t&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&"number"==typeof t.offset&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||e(t.data))}var q=function(e){return Object.keys(e).map(function(t){return e[t]})},Q={shape:function(e){for(var t=[],r=e;r.length;r=r[0])t.push(r.length);return t},flatten:function(e,t,r,n){var a=1;if(t.length)for(var i=0;i<t.length;++i)a*=t[i];else a=0;var o=n||M.allocType(r,a);switch(t.length){case 0:break;case 1:!function(e,t,r){for(var n=0;n<t;++n)r[n]=e[n]}(e,t[0],o);break;case 2:!function(e,t,r,n){for(var a=0,i=0;i<t;++i)for(var o=e[i],f=0;f<r;++f)n[a++]=o[f]}(e,t[0],t[1],o);break;case 3:Y(e,t[0],t[1],t[2],o,0);break;default:X(e,t,0,o,0)}return o}};function Y(e,t,r,n,a,i){for(var o=i,f=0;f<t;++f)for(var u=e[f],s=0;s<r;++s)for(var c=u[s],l=0;l<n;++l)a[o++]=c[l]}function X(e,t,r,n,a){for(var i=1,o=r+1;o<t.length;++o)i*=t[o];var f=t[r];if(t.length-r===4){var u=t[r+1],s=t[r+2],c=t[r+3];for(o=0;o<f;++o)Y(e[o],u,s,c,n,a),a+=i}else for(o=0;o<f;++o)X(e[o],t,r+1,n,a),a+=i}var $={"[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
48]":5121,"[object ArrayBuffer]":5121},K={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},J={dynamic:35048,stream:35040,static:35044},Z=Q.flatten,ee=Q.shape,te=5121,re=5126,ne=[];function ae(e){return 0|$[Object.prototype.toString.call(e)]}function ie(e,t){for(var r=0;r<t.length;++r)e[r]=t[r]}function oe(e,t,r,n,a,i,o){for(var f=0,u=0;u<r;++u)for(var s=0;s<n;++s)e[f++]=t[a*u+i*s+o]}ne[5120]=1,ne[5122]=2,ne[5124]=4,ne[5121]=1,ne[5123]=2,ne[5125]=4,ne[5126]=4;var fe={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},ue=5121,se=5123,ce=5125,le=34963,de=new Float32Array(1),me=new Uint32Array(de.buffer);function pe(e){for(var t=M.allocType(5123,e.length),r=0;r<e.length;++r)if(isNaN(e[r]))t[r]=65535;else if(e[r]===1/0)t[r]=31744;else if(e[r]===-1/0)t[r]=64512;else{de[0]=e[r];var n=me[0],a=n>>>31<<15,i=(n<<1>>>24)-127,o=n>>13&1023;if(i<-24)t[r]=a;else if(i<-14){var f=-14-i;t[r]=a+(o+1024>>f)}else t[r]=i>15?a+31744:a+(i+15<<10)+o}return t}function he(t){return Array.isArray(t)||e(t)}var be=function(e){return!(e&e-1||!e)},ve=3553,ge=34067,ye=34069,xe=6408,we=6406,Ae=6407,_e=6409,ke=6410,Se=32855,Oe=6402,Ee=34041,Te=35904,De=35906,je=36193,Ce=33776,ze=33777,Fe=33778,Ve=33779,Be=5121,Ie=5123,Pe=5125,Le=5126,Re=33071,Me=9728,Ue=9984,We=9987,Ge=4352,He=33984,Ne=[Ue,9986,9985,We],qe=[0,_e,ke,Ae,xe],Qe={};function Ye(e){return"[object "+e+"]"}Qe[6409]=Qe[6406]=Qe[6402]=1,Qe[34041]=Qe[6410]=2,Qe[6407]=Qe[35904]=3,Qe[6408]=Qe[35906]=4;var Xe=Ye("HTMLCanvasElement"),$e=Ye("OffscreenCanvas"),Ke=Ye("CanvasRenderingContext2D"),Je=Ye("ImageBitmap"),Ze=Ye("HTMLImageElement"),et=Ye("HTMLVideoElement"),tt=Object.keys($).concat([Xe,$e,Ke,Je,Ze,et]),rt=[];rt[5121]=1,rt[5126]=4,rt[36193]=2,rt[5123]=2,rt[5125]=4;var nt=[];function at(e){return Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}function it(e){return!!Array.isArray(e)&&!(0===e.length||!he(e[0]))}function ot(e){return Object.prototype.toString.call(e)}function ft(e){return ot(e)===Xe}function ut(e){return ot(e)===$e}function st(e){if(!e)return!1;var t=ot(e);return tt.indexOf(t)>=0||at(e)||it(e)||N(e)}function ct(e){return 0|$[Object.prototype.toString.call(e)]}function lt(e,t){return M.allocType(e.type===je?Le:e.type,t)}function dt(e,t){e.type===je?(e.data=pe(t),M.freeType(t)):e.data=t}function mt(e,t,r,n,a,i){var o;if(o=void 0!==nt[e]?nt[e]:Qe[e]*rt[t],i&&(o*=6),a){for(var f=0,u=r;u>=1;)f+=o*u*u,u/=2;return f}return o*r*n}function pt(r,n,a,i,o,f,u){var s={"don't care":Ge,"dont care":Ge,nice:4354,fast:4353},c={repeat:10497,clamp:Re,mirror:33648},l={nearest:Me,linear:9729},d=t({mipmap:We,"nearest mipmap nearest":Ue,"linear mipmap nearest":9985,"nearest mipmap linear":9986,"linear mipmap linear":We},l),m={none:0,browser:37444},p={uint8:Be,rgba4:32819,rgb565:33635,"rgb5 a1":32820},h={alpha:we,luminance:_e,"luminance alpha":ke,rgb:Ae,rgba:xe,rgba4:32854,"rgb5 a1":Se,rgb565:36194},b={};n.ext_srgb&&(h.srgb=Te,h.srgba=De),n.oes_texture_float&&(p.float32=p.float=Le),n.oes_texture_half_float&&(p.float16=p["half float"]=je),n.webgl_depth_texture&&(t(h,{depth:Oe,"depth stencil":Ee}),t(p,{uint16:Ie,uint32:Pe,"depth stencil":34042})),n.webgl_compressed_texture_s3tc&&t(b,{"rgb s3tc dxt1":Ce,"rgba s3tc dxt1":ze,"rgba s3tc dxt3":Fe,"rgba s3tc dxt5":Ve}),n.webgl_compressed_texture_atc&&t(b,{"rgb atc":35986,"rgba atc explicit alpha":35987,"rgba atc interpolated alpha":34798}),n.webgl_compressed_texture_pvrtc&&t(b,{"rgb pvrtc 4bppv1":35840,"rgb pvrtc 2bppv1":35841,"rgba pvrtc 4bppv1":35842,"rgba pvrtc 2bppv1":35843}),n.webgl_compressed_texture_etc1&&(b["rgb etc1"]=36196);var v=Array.prototype.slice.call(r.getParameter(34467));Object.keys(b).forEach(function(e){var t=b[e];v.indexOf(t)>=0&&(h[e]=t)});var g=Object.keys(h);a.textureFormats=g;var y=[];Object.keys(h).forEach(function(e){var t=h[e];y[t]=e});var x=[];Object.keys(p).forEach(function(e){var t=p[e];x[t]=e});var w=[];Object.keys(l).forEach(function(e){w[l[e]]=e});var A=[];Object.keys(d).forEach(function(e){var t=d[e];A[t]=e});var k=[];
48Object.keys(c).forEach(function(e){k[c[e]]=e});var O=g.reduce(function(e,t){var r=h[t];return r===_e||r===we||r===_e||r===ke||r===Oe||r===Ee||n.ext_srgb&&(r===Te||r===De)?e[r]=r:r===Se||t.indexOf("rgba")>=0?e[r]=xe:e[r]=Ae,e},{});function E(){this.internalformat=xe,this.format=xe,this.type=Be,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=37444,this.width=0,this.height=0,this.channels=0}function T(e,t){e.internalformat=t.internalformat,e.format=t.format,e.type=t.type,e.compressed=t.compressed,e.premultiplyAlpha=t.premultiplyAlpha,e.flipY=t.flipY,e.unpackAlignment=t.unpackAlignment,e.colorSpace=t.colorSpace,e.width=t.width,e.height=t.height,e.channels=t.channels}function D(e,t){if("object"==typeof t&&t){if("premultiplyAlpha"in t&&(S.type(t.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),e.premultiplyAlpha=t.premultiplyAlpha),"flipY"in t&&(S.type(t.flipY,"boolean","invalid texture flip"),e.flipY=t.flipY),"alignment"in t&&(S.oneOf(t.alignment,[1,2,4,8],"invalid texture unpack alignment"),e.unpackAlignment=t.alignment),"colorSpace"in t&&(S.parameter(t.colorSpace,m,"invalid colorSpace"),e.colorSpace=m[t.colorSpace]),"type"in t){var r=t.type;S(n.oes_texture_float||!("float"===r||"float32"===r),"you must enable the OES_texture_float extension in order to use floating point textures."),S(n.oes_texture_half_float||!("half float"===r||"float16"===r),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),S(n.webgl_depth_texture||!("uint16"===r||"uint32"===r||"depth stencil"===r),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),S.parameter(r,p,"invalid texture type"),e.type=p[r]}var i=e.width,o=e.height,f=e.channels,u=!1;"shape"in t?(S(Array.isArray(t.shape)&&t.shape.length>=2,"shape must be an array"),i=t.shape[0],o=t.shape[1],3===t.shape.length&&(f=t.shape[2],S(f>0&&f<=4,"invalid number of channels"),u=!0),S(i>=0&&i<=a.maxTextureSize,"invalid width"),S(o>=0&&o<=a.maxTextureSize,"invalid height")):("radius"in t&&(i=o=t.radius,S(i>=0&&i<=a.maxTextureSize,"invalid radius")),"width"in t&&(i=t.width,S(i>=0&&i<=a.maxTextureSize,"invalid width")),"height"in t&&(o=t.height,S(o>=0&&o<=a.maxTextureSize,"invalid height")),"channels"in t&&(f=t.channels,S(f>0&&f<=4,"invalid number of channels"),u=!0)),e.width=0|i,e.height=0|o,e.channels=0|f;var s=!1;if("format"in t){var c=t.format;S(n.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),S.parameter(c,h,"invalid texture format");var l=e.internalformat=h[c];e.format=O[l],c in p&&("type"in t||(e.type=p[c])),c in b&&(e.compressed=!0),s=!0}!u&&s?e.channels=Qe[e.format]:u&&!s?e.channels!==qe[e.format]&&(e.format=e.internalformat=qe[e.channels]):s&&u&&S(e.channels===Qe[e.format],"number of channels inconsistent with specified format")}}function j(e){r.pixelStorei(37440,e.flipY),r.pixelStorei(37441,e.premultiplyAlpha),r.pixelStorei(37443,e.colorSpace),r.pixelStorei(3317,e.unpackAlignment)}function C(){E.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function z(t,r){var n=null;if(st(r)?n=r:r&&(S.type(r,"object","invalid pixel data type"),D(t,r),"x"in r&&(t.xOffset=0|r.x),"y"in r&&(t.yOffset=0|r.y),st(r.data)&&(n=r.data)),S(!t.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),r.copy){S(!n,"can not specify copy and data field for the same texture");var i=o.viewportWidth,f=o.viewportHeight;t.width=t.width||i-t.xOffset,t.height=t.height||f-t.yOffset,t.needsCopy=!0,S(t.xOffset>=0&&t.xOffset<i&&t.yOffset>=0&&t.yOffset<f&&t.width>0&&t.width<=i&&t.height>0&&t.height<=f,"copy texture read out of bounds")}else if(n){if(e(n))t.channels=t.channels||4,t.data=n,"type"in r||t.type!==Be||(t.type=ct(n));else if(at(n))t.channels=t.channels||4,function(e,t){var r=t.length;switch(e.type){case Be:case Ie:case Pe:case Le:var n=M.allocType(e.type,r);n.set(t),e.data=n;break;case je:e.data=pe(t);break;default:S.raise("unsupported texture type, must specify a typed array")}}(t,n),t.alignment=1,t.needsFree=!0;else if(N(n)){var u=n.data;Array.isArray(u)||t.type!==Be||(t.type=ct(u));var s,c,l,d,m,p,h=n.shape,b=n.stride;3===h.length?(l=h[2],p=b[2]):(S(2===h.length,"invalid ndarray pixel data, must be 2 or 3D"),l=1,p=1),s=h[0],c=h[
481],d=b[0],m=b[1],t.alignment=1,t.width=s,t.height=c,t.channels=l,t.format=t.internalformat=qe[l],t.needsFree=!0,function(e,t,r,n,a,i){for(var o=e.width,f=e.height,u=e.channels,s=lt(e,o*f*u),c=0,l=0;l<f;++l)for(var d=0;d<o;++d)for(var m=0;m<u;++m)s[c++]=t[r*d+n*l+a*m+i];dt(e,s)}(t,u,d,m,p,n.offset)}else if(ft(n)||ut(n)||ot(n)===Ke)ft(n)||ut(n)?t.element=n:t.element=n.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(function(e){return ot(e)===Je}(n))t.element=n,t.width=n.width,t.height=n.height,t.channels=4;else if(function(e){return ot(e)===Ze}(n))t.element=n,t.width=n.naturalWidth,t.height=n.naturalHeight,t.channels=4;else if(function(e){return ot(e)===et}(n))t.element=n,t.width=n.videoWidth,t.height=n.videoHeight,t.channels=4;else if(it(n)){var v=t.width||n[0].length,g=t.height||n.length,y=t.channels;y=he(n[0][0])?y||n[0][0].length:y||1;for(var x=Q.shape(n),w=1,A=0;A<x.length;++A)w*=x[A];var k=lt(t,w);Q.flatten(n,x,"",k),dt(t,k),t.alignment=1,t.width=v,t.height=g,t.channels=y,t.format=t.internalformat=qe[y],t.needsFree=!0}}else t.width=t.width||1,t.height=t.height||1,t.channels=t.channels||4;t.type===Le?S(a.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):t.type===je&&S(a.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function F(e,t,n){var a=e.element,o=e.data,f=e.internalformat,u=e.format,s=e.type,c=e.width,l=e.height;j(e),a?r.texImage2D(t,n,u,u,s,a):e.compressed?r.compressedTexImage2D(t,n,f,c,l,0,o):e.needsCopy?(i(),r.copyTexImage2D(t,n,u,e.xOffset,e.yOffset,c,l,0)):r.texImage2D(t,n,u,c,l,0,u,s,o||null)}function V(e,t,n,a,o){var f=e.element,u=e.data,s=e.internalformat,c=e.format,l=e.type,d=e.width,m=e.height;j(e),f?r.texSubImage2D(t,o,n,a,c,l,f):e.compressed?r.compressedTexSubImage2D(t,o,n,a,s,d,m,u):e.needsCopy?(i(),r.copyTexSubImage2D(t,o,n,a,e.xOffset,e.yOffset,d,m)):r.texSubImage2D(t,o,n,a,d,m,c,l,u)}var B=[];function I(){return B.pop()||new C}function P(e){e.needsFree&&M.freeType(e.data),C.call(e),B.push(e)}function L(){E.call(this),this.genMipmaps=!1,this.mipmapHint=Ge,this.mipmask=0,this.images=Array(16)}function R(e,t,r){var n=e.images[0]=I();e.mipmask=1,n.width=e.width=t,n.height=e.height=r,n.channels=e.channels=4}function U(e,t){var r=null;if(st(t))T(r=e.images[0]=I(),e),z(r,t),e.mipmask=1;else if(D(e,t),Array.isArray(t.mipmap))for(var n=t.mipmap,a=0;a<n.length;++a)T(r=e.images[a]=I(),e),r.width>>=a,r.height>>=a,z(r,n[a]),e.mipmask|=1<<a;else T(r=e.images[0]=I(),e),z(r,t),e.mipmask=1;T(e,e.images[0]),!e.compressed||e.internalformat!==Ce&&e.internalformat!==ze&&e.internalformat!==Fe&&e.internalformat!==Ve||S(e.width%4==0&&e.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function W(e,t){for(var r=e.images,n=0;n<r.length;++n){if(!r[n])return;F(r[n],t,n)}}var G=[];function H(){var e=G.pop()||new L;E.call(e),e.mipmask=0;for(var t=0;t<16;++t)e.images[t]=null;return e}function Y(e){for(var t=e.images,r=0;r<t.length;++r)t[r]&&P(t[r]),t[r]=null;G.push(e)}function X(){this.minFilter=Me,this.magFilter=Me,this.wrapS=Re,this.wrapT=Re,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=Ge}function $(e,t){if("min"in t){var r=t.min;S.parameter(r,d),e.minFilter=d[r],Ne.indexOf(e.minFilter)>=0&&!("faces"in t)&&(e.genMipmaps=!0)}if("mag"in t){var n=t.mag;S.parameter(n,l),e.magFilter=l[n]}var i=e.wrapS,o=e.wrapT;if("wrap"in t){var f=t.wrap;"string"==typeof f?(S.parameter(f,c),i=o=c[f]):Array.isArray(f)&&(S.parameter(f[0],c),S.parameter(f[1],c),i=c[f[0]],o=c[f[1]])}else{if("wrapS"in t){var u=t.wrapS;S.parameter(u,c),i=c[u]}if("wrapT"in t){var m=t.wrapT;S.parameter(m,c),o=c[m]}}if(e.wrapS=i,e.wrapT=o,"anisotropic"in t){var p=t.anisotropic;S("number"==typeof p&&p>=1&&p<=a.maxAnisotropic,"aniso samples must be between 1 and "),e.anisotropic=t.anisotropic}if("mipmap"in t){var h=!1;switch(typeof t.mipmap){case"string":S.parameter(t.mipmap,s,"invalid mipmap hint"),e.mipmapHint=s[t.mipmap],e.genMipmaps=!0,h=!0;break;case"boolean":h=e.genMipmaps=t.mipmap;break;case"object":S(Array.isArray(t.mipmap),"invalid mipmap type"),e.genMipmaps=!1,h=!0;break;default:S.raise("invalid mipmap type")}h&&!("min"in t)&&(e.minFilter=Ue)}}function K(e,t){r.texParameteri(t,10241,e.minFilter),r.texParameteri(t,10240,e.magFilter),r.texParameteri(t,10242,e.wrapS),r.texParameteri(t,10243,e.wrapT),n.ext_texture_filter_anisotropic&&r.texParameteri(t,34046,e.anisotropic),e.genMipmaps&&(r.hint(33170,e.mipmapHint),r.generateMipmap(t))}var J=0,Z={},ee=a.maxTextureUnits,te=Array(ee).map(function(){return null});function re(e){E.call(this),this.mipmask=0,this.internalformat=xe,this.id=J++,this.refCount=1,this.target=e,this.texture=r.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new X,u.profile&&(this.stats={size:0})}function ne(e){r.activeTexture(He),r.bindTexture(e.target,e.texture)}function ae(){var e=te[0];e?r.bindTexture(e.target,e.texture):r.bindTexture(ve,null)}function ie(e){var t=e.texture;S(t,"must not double destroy texture");var n=e.unit,a=e.target;n>=0&&(r.activeTexture(He+n),r.bindTexture(a,null),te[n]=null),r.deleteTexture(t),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete Z[e.id],f.textureCount--}return t(re.prototype,{bind:function(){var e=this;e.bindCount+=1;var t=e.unit;if(t<0){for(var n=0;n<ee;++n){var a=te[n];if(a){if(a.bindCount>0)continue;a.unit=-1}te[n]=e,t=n;break}t>=ee&&S.raise("insufficient number of texture units"),u.profile&&f.maxTextureUnits<t+1&&(f.maxTextureUnits=t+1),e.unit=t,r.activeTexture(He+t),r.bindTexture(e.target,e.texture)}return t},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&ie(this)}}),u.profile&&(f.getTotalTextureSize=function(){var e=0;
48return Object.keys(Z).forEach(function(t){e+=Z[t].stats.size}),e}),{create2D:function(e,t){var n=new re(ve);function i(e,t){var r=n.texInfo;X.call(r);var o=H();return"number"==typeof e?R(o,0|e,"number"==typeof t?0|t:0|e):e?(S.type(e,"object","invalid arguments to regl.texture"),$(r,e),U(o,e)):R(o,1,1),r.genMipmaps&&(o.mipmask=(o.width<<1)-1),n.mipmask=o.mipmask,T(n,o),S.texture2D(r,o,a),n.internalformat=o.internalformat,i.width=o.width,i.height=o.height,ne(n),W(o,ve),K(r,ve),ae(),Y(o),u.profile&&(n.stats.size=mt(n.internalformat,n.type,o.width,o.height,r.genMipmaps,!1)),i.format=y[n.internalformat],i.type=x[n.type],i.mag=w[r.magFilter],i.min=A[r.minFilter],i.wrapS=k[r.wrapS],i.wrapT=k[r.wrapT],i}return Z[n.id]=n,f.textureCount++,i(e,t),i.subimage=function(e,t,r,a){S(!!e,"must specify image data");var o=0|t,f=0|r,u=0|a,s=I();return T(s,n),s.width=0,s.height=0,z(s,e),s.width=s.width||(n.width>>u)-o,s.height=s.height||(n.height>>u)-f,S(n.type===s.type&&n.format===s.format&&n.internalformat===s.internalformat,"incompatible format for texture.subimage"),S(o>=0&&f>=0&&o+s.width<=n.width&&f+s.height<=n.height,"texture.subimage write out of bounds"),S(n.mipmask&1<<u,"missing mipmap data"),S(s.data||s.element||s.needsCopy,"missing image data"),ne(n),V(s,ve,o,f,u),ae(),P(s),i},i.resize=function(e,t){var a=0|e,o=0|t||a;if(a===n.width&&o===n.height)return i;i.width=n.width=a,i.height=n.height=o,ne(n);for(var f=0;n.mipmask>>f;++f){var s=a>>f,c=o>>f;if(!s||!c)break;r.texImage2D(ve,f,n.format,s,c,0,n.format,n.type,null)}return ae(),u.profile&&(n.stats.size=mt(n.internalformat,n.type,a,o,!1,!1)),i},i._reglType="texture2d",i._texture=n,u.profile&&(i.stats=n.stats),i.destroy=function(){n.decRef()},i},createCube:function(e,t,n,i,o,s){var c=new re(ge);Z[c.id]=c,f.cubeCount++;var l=new Array(6);function d(e,t,r,n,i,o){var f,s=c.texInfo;for(X.call(s),f=0;f<6;++f)l[f]=H();if("number"!=typeof e&&e)if("object"==typeof e)if(t)U(l[0],e),U(l[1],t),U(l[2],r),U(l[3],n),U(l[4],i),U(l[5],o);else if($(s,e),D(c,e),"faces"in e){var m=e.faces;for(S(Array.isArray(m)&&6===m.length,"cube faces must be a length 6 array"),f=0;f<6;++f)S("object"==typeof m[f]&&!!m[f],"invalid input for cube map face"),T(l[f],c),U(l[f],m[f])}else for(f=0;f<6;++f)U(l[f],e);else S.raise("invalid arguments to cube map");else{var p=0|e||1;for(f=0;f<6;++f)R(l[f],p,p)}for(T(c,l[0]),S.optional(function(){a.npotTextureCube||S(be(c.width)&&be(c.height),"your browser does not support non power or two texture dimensions")}),s.genMipmaps?c.mipmask=(l[0].width<<1)-1:c.mipmask=l[0].mipmask,S.textureCube(c,s,l,a),c.internalformat=l[0].internalformat,d.width=l[0].width,d.height=l[0].height,ne(c),f=0;f<6;++f)W(l[f],ye+f);for(K(s,ge),ae(),u.profile&&(c.stats.size=mt(c.internalformat,c.type,d.width,d.height,s.genMipmaps,!0)),d.format=y[c.internalformat],d.type=x[c.type],d.mag=w[s.magFilter],d.min=A[s.minFilter],d.wrapS=k[s.wrapS],d.wrapT=k[s.wrapT],f=0;f<6;++f)Y(l[f]);return d}return d(e,t,n,i,o,s),d.subimage=function(e,t,r,n,a){S(!!t,"must specify image data"),S("number"==typeof e&&e===(0|e)&&e>=0&&e<6,"invalid face");var i=0|r,o=0|n,f=0|a,u=I();return T(u,c),u.width=0,u.height=0,z(u,t),u.width=u.width||(c.width>>f)-i,u.height=u.height||(c.height>>f)-o,S(c.type===u.type&&c.format===u.format&&c.internalformat===u.internalformat,"incompatible format for texture.subimage"),S(i>=0&&o>=0&&i+u.width<=c.width&&o+u.height<=c.height,"texture.subimage write out of bounds"),S(c.mipmask&1<<f,"missing mipmap data"),S(u.data||u.element||u.needsCopy,"missing image data"),ne(c),V(u,ye+e,i,o,f),ae(),P(u),d},d.resize=function(e){var t=0|e;if(t!==c.width){d.width=c.width=t,d.height=c.height=t,ne(c);for(var n=0;n<6;++n)for(var a=0;c.mipmask>>a;++a)r.texImage2D(ye+n,a,c.format,t>>a,t>>a,0,c.format,c.type,null);return ae(),u.profile&&(c.stats.size=mt(c.internalformat,c.type,d.width,d.height,!1,!0)),d}},d._reglType="textureCube",d._texture=c,u.profile&&(d.stats=c.stats),d.destroy=function(){c.decRef()},d},clear:function(){for(var e=0;e<ee;++e)r.activeTexture(He+e),r.bindTexture(ve,null),te[e]=null;q(Z).forEach(ie),f.cubeCount=0,f.textureCount=0},getTexture:function(e){return null},restore:function(){for(var e=0;e<ee;++e){var t=te[e];t&&(t.bindCount=0,t.unit=-1,te[e]=null)}
48q(Z).forEach(function(e){e.texture=r.createTexture(),r.bindTexture(e.target,e.texture);for(var t=0;t<32;++t)if(e.mipmask&1<<t)if(e.target===ve)r.texImage2D(ve,t,e.internalformat,e.width>>t,e.height>>t,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)r.texImage2D(ye+n,t,e.internalformat,e.width>>t,e.height>>t,0,e.internalformat,e.type,null);K(e.texInfo,e.target)})},refresh:function(){for(var e=0;e<ee;++e){var t=te[e];t&&(t.bindCount=0,t.unit=-1,te[e]=null),r.activeTexture(He+e),r.bindTexture(ve,null),r.bindTexture(ge,null)}}}}nt[32854]=2,nt[32855]=2,nt[36194]=2,nt[34041]=4,nt[33776]=.5,nt[33777]=.5,nt[33778]=1,nt[33779]=1,nt[35986]=.5,nt[35987]=1,nt[34798]=1,nt[35840]=.5,nt[35841]=.25,nt[35842]=.5,nt[35843]=.25,nt[36196]=.5;var ht=36161,bt=32854,vt=[];function gt(e,t,r){return vt[e]*t*r}vt[32854]=2,vt[32855]=2,vt[36194]=2,vt[33189]=2,vt[36168]=1,vt[34041]=4,vt[35907]=4,vt[34836]=16,vt[34842]=8,vt[34843]=6;var yt=36160,xt=36161,wt=3553,At=34069,_t=[6407,6408],kt=[];kt[6408]=4,kt[6407]=3;var St=[];St[5121]=1,St[5126]=4,St[36193]=2;var Ot=[32854,32855,36194,35907,34842,34843,34836],Et={36053:"complete",36054:"incomplete attachment",36057:"incomplete dimensions",36055:"incomplete, missing attachment",36061:"unsupported"},Tt=34963,Dt=["attributes","elements","offset","count","primitive","instances"];function jt(){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=5126,this.offset=0,this.stride=0,this.divisor=0}var Ct=5121,zt=5126;function Ft(t,r,n,a,i,o,f){function u(u){var s;null===r.next?(S(i.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),s=Ct):(S(null!==r.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),s=r.next.colorAttachments[0].texture._texture.type,S.optional(function(){o.oes_texture_float?(S(s===Ct||s===zt,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),s===zt&&S(f.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):S(s===Ct,"Reading from a framebuffer is only allowed for the type 'uint8'")}));var c=0,l=0,d=a.framebufferWidth,m=a.framebufferHeight,p=null;e(u)?p=u:u&&(S.type(u,"object","invalid arguments to regl.read()"),c=0|u.x,l=0|u.y,S(c>=0&&c<a.framebufferWidth,"invalid x offset for regl.read"),S(l>=0&&l<a.framebufferHeight,"invalid y offset for regl.read"),d=0|(u.width||a.framebufferWidth-c),m=0|(u.height||a.framebufferHeight-l),p=u.data||null),p&&(s===Ct?S(p instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):s===zt&&S(p instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),S(d>0&&d+c<=a.framebufferWidth,"invalid width for read pixels"),S(m>0&&m+l<=a.framebufferHeight,"invalid height for read pixels"),n();var h=d*m*4;return p||(s===Ct?p=new Uint8Array(h):s===zt&&(p=p||new Float32Array(h))),S.isTypedArray(p,"data buffer for regl.read() must be a typedarray"),S(p.byteLength>=h,"data buffer for regl.read() too small"),t.pixelStorei(3333,4),t.readPixels(c,l,d,m,6408,s,p),p}return function(e){return e&&"framebuffer"in e?function(e){var t;return r.setFBO({framebuffer:e.framebuffer},function(){t=u(e)}),t}(e):u(e)}}function Vt(e){return Array.prototype.slice.call(e)}function Bt(e){return Vt(e).join("")}var It="xyzw".split(""),Pt="dither",Lt="blend.enable",Rt="blend.color",Mt="blend.equation",Ut="blend.func",Wt="depth.enable",Gt="depth.func",Ht="depth.range",Nt="depth.mask",qt="colorMask",Qt="cull.enable",Yt="cull.face",Xt="frontFace",$t="lineWidth",Kt="polygonOffset.enable",Jt="polygonOffset.offset",Zt="sample.alpha",er="sample.enable",tr="sample.coverage",rr="stencil.enable",nr="stencil.mask",ar="stencil.func",ir="stencil.opFront",or="stencil.opBack",fr="scissor.enable",ur="scissor.box",sr="viewport",cr="profile",lr="framebuffer",dr="vert",mr="frag",pr="elements",hr="primitive",br="count",vr="offset",gr="instances",yr="vao",xr="Width",wr="Height",Ar=lr+xr,_r=lr+wr,kr=sr+xr,Sr=sr+wr,Or="drawingBuffer",Er=Or+xr,Tr=Or+wr,Dr=[Ut,Mt,ar,ir,or,tr,sr,ur,Jt],jr=34962,Cr=34963,zr=5126,Fr=35664,Vr=35665,Br=35666,Ir=5124,Pr=35667,Lr=35668,Rr=35669,Mr=35670,Ur=35671,Wr=35672,Gr=35673,Hr=35674,Nr=35675,qr=35676,Qr=35678,Yr=35680,Xr=1028,$r=1029,Kr=2305,Jr=7680,Zr={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 alph
48a":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},en=["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"],tn={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},rn={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},nn={frag:35632,vert:35633},an={cw:2304,ccw:Kr};function on(t){return Array.isArray(t)||e(t)||N(t)}function fn(e){return e.sort(function(e,t){return e===sr?-1:t===sr?1:e<t?-1:1})}function un(e,t,r,n){this.thisDep=e,this.contextDep=t,this.propDep=r,this.append=n}function sn(e){return e&&!(e.thisDep||e.contextDep||e.propDep)}function cn(e){return new un(!1,!1,!1,e)}function ln(e,t){var r=e.type;if(0===r){var n=e.data.length;return new un(!0,n>=1,n>=2,t)}if(4===r){var a=e.data;return new un(a.thisDep,a.contextDep,a.propDep,t)}if(5===r)return new un(!1,!1,!1,t);if(6===r){for(var i=!1,o=!1,f=!1,u=0;u<e.data.length;++u){var s=e.data[u];if(1===s.type)f=!0;else if(2===s.type)o=!0;else if(3===s.type)i=!0;else if(0===s.type){i=!0;var c=s.data;c>=1&&(o=!0),c>=2&&(f=!0)}else 4===s.type&&(i=i||s.data.thisDep,o=o||s.data.contextDep,f=f||s.data.propDep)}return new un(i,o,f,t)}return new un(3===r,2===r,1===r,t)}var dn=new un(!1,!1,!1,function(){});function mn(e,r,n,a,i,o,f,u,s,c,l,d,m,p,h){var b=c.Record,v={add:32774,subtract:32778,"reverse subtract":32779};n.ext_blend_minmax&&(v.min=32775,v.max=32776);var g=n.angle_instanced_arrays,y=n.webgl_draw_buffers,x=n.oes_vertex_array_object,w={dirty:!0,profile:h.profile},A={},k=[],O={},E={};function T(e){return e.replace(".","_")}function D(e,t,r){var n=T(e);k.push(e),A[n]=w[n]=!!r,O[n]=t}function j(e,t,r){var n=T(e);k.push(e),Array.isArray(r)?(w[n]=r.slice(),A[n]=r.slice()):w[n]=A[n]=r,E[n]=t}D(Pt,3024),D(Lt,3042),j(Rt,"blendColor",[0,0,0,0]),j(Mt,"blendEquationSeparate",[32774,32774]),j(Ut,"blendFuncSeparate",[1,0,1,0]),D(Wt,2929,!0),j(Gt,"depthFunc",513),j(Ht,"depthRange",[0,1]),j(Nt,"depthMask",!0),j(qt,qt,[!0,!0,!0,!0]),D(Qt,2884),j(Yt,"cullFace",$r),j(Xt,Xt,Kr),j($t,$t,1),D(Kt,32823),j(Jt,"polygonOffset",[0,0]),D(Zt,32926),D(er,32928),j(tr,"sampleCoverage",[1,!1]),D(rr,2960),j(nr,"stencilMask",-1),j(ar,"stencilFunc",[519,0,-1]),j(ir,"stencilOpSeparate",[Xr,Jr,Jr,Jr]),j(or,"stencilOpSeparate",[$r,Jr,Jr,Jr]),D(fr,3089),j(ur,"scissor",[0,0,e.drawingBufferWidth,e.drawingBufferHeight]),j(sr,sr,[0,0,e.drawingBufferWidth,e.drawingBufferHeight]);var z={gl:e,context:m,strings:r,next:A,current:w,draw:d,elements:o,buffer:i,shader:l,attributes:c.state,vao:c,uniforms:s,framebuffer:u,extensions:n,timer:p,isBufferArgs:on},F={primTypes:fe,compareFuncs:tn,blendFuncs:Zr,blendEquations:v,stencilOps:rn,glTypes:K,orientationType:an};S.optional(function(){z.isArrayLike=he}),y&&(F.backBuffer=[$r],F.drawBuffer=P(a.maxDrawbuffers,function(e){return 0===e?[0]:P(e,function(e){return 36064+e})}));var V=0;function B(){var e=function(){var e=0,r=[],n=[];function a(){var r=[],n=[];return t(function(){r.push.apply(r,Vt(arguments))},{def:function(){var t="v"+e++;return n.push(t),arguments.length>0&&(r.push(t,"="),r.push.apply(r,Vt(arguments)),r.push(";")),t},toString:function(){return Bt([n.length>0?"var "+n.join(",")+";":"",Bt(r)])}})}function i(){var e=a(),r=a(),n=e.toString,i=r.toString;function o(t,n){r(t,n,"=",e.def(t,n),";")}return t(function(){e.apply(e,Vt(arguments))},{def:e.def,entry:e,exit:r,save:o,set:function(t,r,n){o(t,r),e(t,r,"=",n,";")},toString:function(){return n()+i()}})}var o=a(),f={};return{global:o,link:function(t){for(var a=0;a<n.length;++a)if(n[a]===t)return r[a];var i="g"+e++;return r.push(i),n.push(t),i},block:a,proc:function(e,r){var n=[];function a(){var e="a"+n.length;return n.push(e),e}r=r||0;for(var o=0;o<r;++o)a();var u=i(),s=u.toString;return f[e]=t(u,{arg:a,toString:function(){return Bt(["function(",n.join(),"){",s(),"}"])}})},scope:i,cond:function(){var e=Bt(arguments),r=i(),n=i(),a=r.toString,o=n.toString;return t(r,{then:function(){return r.apply(r,Vt(arguments)),this},else:function(){return n.apply(n,Vt(arguments)),this},toString:function(){var t=o();return t&&(t="else{"+t+"}"),Bt(["if(",e,"){",a(),"}",t])}})},compile:function(){var e=['"use strict";',o,"return {"];Object.keys(f).forEach(function(t){e.push('"',t,'":',f[t].toString(),",")}),e.push("}");var t=Bt(e).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,r.concat(t)).apply(null,n)}}}(),n=e.link,a=e.global;e.id=V++,e.batchId="0";var i=n(z),o=e.shared={props:"a0"};Object.keys(z).forEach(function(e){o[e]=a.def(i,".",e)}),S.optional(function(){e.CHECK=n(S),e.commandStr=S.guessCommand(),e.command=n(e.commandStr),e.assert=function(e,t,r){e("if(!(",t,"))",this.CHECK,".commandRaise(",n(r),",",this.command,");")},F.invalidBlendCombinations=en});var f=e.next={},u=e.current={};
48Object.keys(E).forEach(function(e){Array.isArray(w[e])&&(f[e]=a.def(o.next,".",e),u[e]=a.def(o.current,".",e))});var s=e.constants={};Object.keys(F).forEach(function(e){s[e]=a.def(JSON.stringify(F[e]))}),e.invoke=function(t,r){switch(r.type){case 0:var a=["this",o.context,o.props,e.batchId];return t.def(n(r.data),".call(",a.slice(0,Math.max(r.data.length+1,4)),")");case 1:return t.def(o.props,r.data);case 2:return t.def(o.context,r.data);case 3:return t.def("this",r.data);case 4:return r.data.append(e,t),r.data.ref;case 5:return r.data.toString();case 6:return r.data.map(function(r){return e.invoke(t,r)})}},e.attribCache={};var l={};return e.scopeAttrib=function(e){var t=r.id(e);if(t in l)return l[t];var a=c.scope[t];return a||(a=c.scope[t]=new b),l[t]=n(a)},e}function I(e,t,f,s,d){var m=e.static,p=e.dynamic;S.optional(function(){var e=[lr,dr,mr,pr,hr,vr,br,gr,cr,yr].concat(k);function t(t){Object.keys(t).forEach(function(t){S.command(e.indexOf(t)>=0,'unknown parameter "'+t+'"',d.commandStr)})}t(m),t(p)});var h=function(e,t){var r=e.static;if("string"==typeof r[mr]&&"string"==typeof r[dr]){if(Object.keys(t.dynamic).length>0)return null;var n=t.static,a=Object.keys(n);if(a.length>0&&"number"==typeof n[a[0]]){for(var i=[],o=0;o<a.length;++o)S("number"==typeof n[a[o]],"must specify all vertex attribute locations when using vaos"),i.push([0|n[a[o]],a[o]]);return i}}return null}(e,t),y=function(e){var t=e.static,r=e.dynamic;if(lr in t){var n=t[lr];return n?(n=u.getFramebuffer(n),S.command(n,"invalid framebuffer object"),cn(function(e,t){var r=e.link(n),a=e.shared;t.set(a.framebuffer,".next",r);var i=a.context;return t.set(i,"."+Ar,r+".width"),t.set(i,"."+_r,r+".height"),r})):cn(function(e,t){var r=e.shared;t.set(r.framebuffer,".next","null");var n=r.context;return t.set(n,"."+Ar,n+"."+Er),t.set(n,"."+_r,n+"."+Tr),"null"})}if(lr in r){var a=r[lr];return ln(a,function(e,t){var r=e.invoke(t,a),n=e.shared,i=n.framebuffer,o=t.def(i,".getFramebuffer(",r,")");S.optional(function(){e.assert(t,"!"+r+"||"+o,"invalid framebuffer object")}),t.set(i,".next",o);var f=n.context;return t.set(f,"."+Ar,o+"?"+o+".width:"+f+"."+Er),t.set(f,"."+_r,o+"?"+o+".height:"+f+"."+Tr),o})}return null}(e),x=function(e,t,r){var n=e.static,a=e.dynamic;function i(e){if(e in n){var i=n[e];S.commandType(i,"object","invalid "+e,r.commandStr);var o,f,u=!0,s=0|i.x,c=0|i.y;return"width"in i?(o=0|i.width,S.command(o>=0,"invalid "+e,r.commandStr)):u=!1,"height"in i?(f=0|i.height,S.command(f>=0,"invalid "+e,r.commandStr)):u=!1,new un(!u&&t&&t.thisDep,!u&&t&&t.contextDep,!u&&t&&t.propDep,function(e,t){var r=e.shared.context,n=o;"width"in i||(n=t.def(r,".",Ar,"-",s));var a=f;return"height"in i||(a=t.def(r,".",_r,"-",c)),[s,c,n,a]})}if(e in a){var l=a[e],d=ln(l,function(t,r){var n=t.invoke(r,l);S.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)});var a=t.shared.context,i=r.def(n,".x|0"),o=r.def(n,".y|0"),f=r.def('"width" in ',n,"?",n,".width|0:","(",a,".",Ar,"-",i,")"),u=r.def('"height" in ',n,"?",n,".height|0:","(",a,".",_r,"-",o,")");return S.optional(function(){t.assert(r,f+">=0&&"+u+">=0","invalid "+e)}),[i,o,f,u]});return t&&(d.thisDep=d.thisDep||t.thisDep,d.contextDep=d.contextDep||t.contextDep,d.propDep=d.propDep||t.propDep),d}return t?new un(t.thisDep,t.contextDep,t.propDep,function(e,t){var r=e.shared.context;return[0,0,t.def(r,".",Ar),t.def(r,".",_r)]}):null}var o=i(sr);if(o){var f=o;o=new un(o.thisDep,o.contextDep,o.propDep,function(e,t){var r=f.append(e,t),n=e.shared.context;return t.set(n,"."+kr,r[2]),t.set(n,"."+Sr,r[3]),r})}return{viewport:o,scissor_box:i(ur)}}(e,y,d),w=function(e,t){var r=e.static,n=e.dynamic,a={},i=!1,f=function(){if(yr in r){var e=r[yr];return null!==e&&null===c.getVAO(e)&&(e=c.createVAO(e)),i=!0,a.vao=e,cn(function(t){var r=c.getVAO(e);return r?t.link(r):"null"})}if(yr in n){i=!0;var t=n[yr];return ln(t,function(e,r){var n=e.invoke(r,t);return r.def(e.shared.vao+".getVAO("+n+")")})}return null}(),u=!1,s=function(){if(pr in r){var e=r[pr];if(a.elements=e,on(e)){var s=a.elements=o.create(e,!0);e=o.getElements(s),u=!0}
48else e&&(e=o.getElements(e),u=!0,S.command(e,"invalid elements",t.commandStr));var c=cn(function(t,r){if(e){var n=t.link(e);return t.ELEMENTS=n,n}return t.ELEMENTS=null,null});return c.value=e,c}if(pr in n){u=!0;var l=n[pr];return ln(l,function(e,t){var r=e.shared,n=r.isBufferArgs,a=r.elements,i=e.invoke(t,l),o=t.def("null"),f=t.def(n,"(",i,")"),u=e.cond(f).then(o,"=",a,".createStream(",i,");").else(o,"=",a,".getElements(",i,");");return S.optional(function(){e.assert(u.else,"!"+i+"||"+o,"invalid elements")}),t.entry(u),t.exit(e.cond(f).then(a,".destroyStream(",o,");")),e.ELEMENTS=o,o})}return i?new un(f.thisDep,f.contextDep,f.propDep,function(e,t){return t.def(e.shared.vao+".currentVAO?"+e.shared.elements+".getElements("+e.shared.vao+".currentVAO.elements):null")}):null}();function l(e,o){if(e in r){var s=0|r[e];return o?a.offset=s:a.instances=s,S.command(!o||s>=0,"invalid "+e,t.commandStr),cn(function(e,t){return o&&(e.OFFSET=s),s})}if(e in n){var c=n[e];return ln(c,function(t,r){var n=t.invoke(r,c);return o&&(t.OFFSET=n,S.optional(function(){t.assert(r,n+">=0","invalid "+e)})),n})}if(o){if(u)return cn(function(e,t){return e.OFFSET=0,0});if(i)return new un(f.thisDep,f.contextDep,f.propDep,function(e,t){return t.def(e.shared.vao+".currentVAO?"+e.shared.vao+".currentVAO.offset:0")})}else if(i)return new un(f.thisDep,f.contextDep,f.propDep,function(e,t){return t.def(e.shared.vao+".currentVAO?"+e.shared.vao+".currentVAO.instances:-1")});return null}var d=l(vr,!0),m=function(){if(hr in r){var e=r[hr];return a.primitive=e,S.commandParameter(e,fe,"invalid primitve",t.commandStr),cn(function(t,r){return fe[e]})}if(hr in n){var o=n[hr];return ln(o,function(e,t){var r=e.constants.primTypes,n=e.invoke(t,o);return S.optional(function(){e.assert(t,n+" in "+r,"invalid primitive, must be one of "+Object.keys(fe))}),t.def(r,"[",n,"]")})}return u?sn(s)?s.value?cn(function(e,t){return t.def(e.ELEMENTS,".primType")}):cn(function(){return 4}):new un(s.thisDep,s.contextDep,s.propDep,function(e,t){var r=e.ELEMENTS;return t.def(r,"?",r,".primType:",4)}):i?new un(f.thisDep,f.contextDep,f.propDep,function(e,t){return t.def(e.shared.vao+".currentVAO?"+e.shared.vao+".currentVAO.primitive:4")}):null}(),p=function(){if(br in r){var e=0|r[br];return a.count=e,S.command("number"==typeof e&&e>=0,"invalid vertex count",t.commandStr),cn(function(){return e})}if(br in n){var o=n[br];return ln(o,function(e,t){var r=e.invoke(t,o);return S.optional(function(){e.assert(t,"typeof "+r+'==="number"&&'+r+">=0&&"+r+"===("+r+"|0)","invalid vertex count")}),r})}if(u){if(sn(s)){if(s)return d?new un(d.thisDep,d.contextDep,d.propDep,function(e,t){var r=t.def(e.ELEMENTS,".vertCount-",e.OFFSET);return S.optional(function(){e.assert(t,r+">=0","invalid vertex offset/element buffer too small")}),r}):cn(function(e,t){return t.def(e.ELEMENTS,".vertCount")});var c=cn(function(){return-1});return S.optional(function(){c.MISSING=!0}),c}var l=new un(s.thisDep||d.thisDep,s.contextDep||d.contextDep,s.propDep||d.propDep,function(e,t){var r=e.ELEMENTS;return e.OFFSET?t.def(r,"?",r,".vertCount-",e.OFFSET,":-1"):t.def(r,"?",r,".vertCount:-1")});return S.optional(function(){l.DYNAMIC=!0}),l}if(i){var m=new un(f.thisDep,f.contextDep,f.propDep,function(e,t){return t.def(e.shared.vao,".currentVAO?",e.shared.vao,".currentVAO.count:-1")});return m}return null}(),h=l(gr,!1);return{elements:s,primitive:m,count:p,instances:h,offset:d,vao:f,vaoActive:i,elementsActive:u,static:a}}(e,d),A=function(e,t){var r=e.static,n=e.dynamic,i={};return k.forEach(function(e){var o=T(e);function f(t,a){if(e in r){var f=t(r[e]);i[o]=cn(function(){return f})}else if(e in n){var u=n[e];i[o]=ln(u,function(e,t){return a(e,t,e.invoke(t,u))})}}switch(e){case Qt:case Lt:case Pt:case rr:case Wt:case fr:case Kt:case Zt:case er:case Nt:return f(function(r){return S.commandType(r,"boolean",e,t.commandStr),r},function(t,r,n){return S.optional(function(){t.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+e,t.commandStr)}),n});case Gt:return f(function(r){return S.commandParameter(r,tn,"invalid "+e,t.commandStr),tn[r]},function(t,r,n){var a=t.constants.compareFuncs;return S.optional(function(){t.assert(r,n+" in "+a,"invalid "+e+", must be one of "+Object.keys(tn))}),r.def(a,"[",n,"]")});case Ht:return f(function(e){return S.command(he(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&e[0]<=e[1],"depth range is 2d array",t.commandStr),e},function(e,t,r){return S.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[t.def("+",r,"[0]"),t.def("+",r,"[1]")]});
48case Ut:return f(function(e){S.commandType(e,"object","blend.func",t.commandStr);var r="srcRGB"in e?e.srcRGB:e.src,n="srcAlpha"in e?e.srcAlpha:e.src,a="dstRGB"in e?e.dstRGB:e.dst,i="dstAlpha"in e?e.dstAlpha:e.dst;return S.commandParameter(r,Zr,o+".srcRGB",t.commandStr),S.commandParameter(n,Zr,o+".srcAlpha",t.commandStr),S.commandParameter(a,Zr,o+".dstRGB",t.commandStr),S.commandParameter(i,Zr,o+".dstAlpha",t.commandStr),S.command(-1===en.indexOf(r+", "+a),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+a+")",t.commandStr),[Zr[r],Zr[a],Zr[n],Zr[i]]},function(t,r,n){var a=t.constants.blendFuncs;function i(i,o){var f=r.def('"',i,o,'" in ',n,"?",n,".",i,o,":",n,".",i);return S.optional(function(){t.assert(r,f+" in "+a,"invalid "+e+"."+i+o+", must be one of "+Object.keys(Zr))}),f}S.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=i("src","RGB"),f=i("dst","RGB");S.optional(function(){var e=t.constants.invalidBlendCombinations;t.assert(r,e+".indexOf("+o+'+", "+'+f+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var u=r.def(a,"[",o,"]"),s=r.def(a,"[",i("src","Alpha"),"]");return[u,r.def(a,"[",f,"]"),s,r.def(a,"[",i("dst","Alpha"),"]")]});case Mt:return f(function(r){return"string"==typeof r?(S.commandParameter(r,v,"invalid "+e,t.commandStr),[v[r],v[r]]):"object"==typeof r?(S.commandParameter(r.rgb,v,e+".rgb",t.commandStr),S.commandParameter(r.alpha,v,e+".alpha",t.commandStr),[v[r.rgb],v[r.alpha]]):void S.commandRaise("invalid blend.equation",t.commandStr)},function(t,r,n){var a=t.constants.blendEquations,i=r.def(),o=r.def(),f=t.cond("typeof ",n,'==="string"');return S.optional(function(){function r(e,r,n){t.assert(e,n+" in "+a,"invalid "+r+", must be one of "+Object.keys(v))}r(f.then,e,n),t.assert(f.else,n+"&&typeof "+n+'==="object"',"invalid "+e),r(f.else,e+".rgb",n+".rgb"),r(f.else,e+".alpha",n+".alpha")}),f.then(i,"=",o,"=",a,"[",n,"];"),f.else(i,"=",a,"[",n,".rgb];",o,"=",a,"[",n,".alpha];"),r(f),[i,o]});case Rt:return f(function(e){return S.command(he(e)&&4===e.length,"blend.color must be a 4d array",t.commandStr),P(4,function(t){return+e[t]})},function(e,t,r){return S.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),P(4,function(e){return t.def("+",r,"[",e,"]")})});case nr:return f(function(e){return S.commandType(e,"number",o,t.commandStr),0|e},function(e,t,r){return S.optional(function(){e.assert(t,"typeof "+r+'==="number"',"invali
48d stencil.mask")}),t.def(r,"|0")});case ar:return f(function(r){S.commandType(r,"object",o,t.commandStr);var n=r.cmp||"keep",a=r.ref||0,i="mask"in r?r.mask:-1;return S.commandParameter(n,tn,e+".cmp",t.commandStr),S.commandType(a,"number",e+".ref",t.commandStr),S.commandType(i,"number",e+".mask",t.commandStr),[tn[n],a,i]},function(e,t,r){var n=e.constants.compareFuncs;return S.optional(function(){function a(){e.assert(t,Array.prototype.join.call(arguments,""),"invalid stencil.func")}a(r+"&&typeof ",r,'==="object"'),a('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[t.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Jr),t.def(r,".ref|0"),t.def('"mask" in ',r,"?",r,".mask|0:-1")]});case ir:case or:return f(function(r){S.commandType(r,"object",o,t.commandStr);var n=r.fail||"keep",a=r.zfail||"keep",i=r.zpass||"keep";return S.commandParameter(n,rn,e+".fail",t.commandStr),S.commandParameter(a,rn,e+".zfail",t.commandStr),S.commandParameter(i,rn,e+".zpass",t.commandStr),[e===or?$r:Xr,rn[n],rn[a],rn[i]]},function(t,r,n){var a=t.constants.stencilOps;function i(i){return S.optional(function(){t.assert(r,'!("'+i+'" in '+n+")||("+n+"."+i+" in "+a+")","invalid "+e+"."+i+", must be one of "+Object.keys(rn))}),r.def('"',i,'" in ',n,"?",a,"[",n,".",i,"]:",Jr)}return S.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)}),[e===or?$r:Xr,i("fail"),i("zfail"),i("zpass")]});case Jt:return f(function(e){S.commandType(e,"object",o,t.commandStr);var r=0|e.factor,n=0|e.units;return S.commandType(r,"number",o+".factor",t.commandStr),S.commandType(n,"number",o+".units",t.commandStr),[r,n]},function(t,r,n){return S.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case Yt:return f(function(e){var r=0;return"front"===e?r=Xr:"back"===e&&(r=$r),S.command(!!r,o,t.commandStr),r},function(e,t,r){return S.optional(function(){e.assert(t,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),t.def(r,'==="front"?',Xr,":",$r)});case $t:return f(function(e){return S.command("number"==typeof e&&e>=a.lineWidthDims[0]&&e<=a.lineWidthDims[1],"invalid line width, must be a positive number between "+a.lineWidthDims[0]+" and "+a.lineWidthDims[1],t.commandStr),e},function(e,t,r){return S.optional(function(){e.assert(t,"typeof "+r+'==="number"&&'+r+">="+a.lineWidthDims[0]+"&&"+r+"<="+a.lineWidthDims[1],"invalid line width")}),r});case Xt:return f(function(e){return S.commandParameter(e,an,o,t.commandStr),an[e]},function(e,t,r){return S.optional(function(){e.assert(t,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),t.def(r+'==="cw"?2304:'+Kr)});case qt:return f(function(e){return S.command(he(e)&&4===e.length,"color.mask must be length 4 array",t.commandStr),e.map(function(e){return!!e})},function(e,t,r){return S.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),P(4,function(e){return"!!"+r+"["+e+"]"})});case tr:return f(function(e){S.command("object"==typeof e&&e,o,t.commandStr);var r="value"in e?e.value:1,n=!!e.invert;return S.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",t.commandStr),[r,n]},function(e,t,r){return S.optional(function(){e.assert(t,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[t.def('"value" in ',r,"?+",r,".value:1"),t.def("!!",r,".invert")]})}}),i}(e,d),O=function(e,t,n){var a=e.static,i=e.dynamic;function o(e){if(e in a){var t=r.id(a[e]);S.optional(function(){l.shader(nn[e],t,S.guessCommand())});var n=cn(function(){return t});return n.id=t,n}if(e in i){var o=i[e];return ln(o,function(t,r){var n=t.invoke(r,o),a=r.def(t.shared.strings,".id(",n,")");return S.optional(function(){r(t.shared.shader,".shader(",nn[e],",",a,",",t.command,");")}),a})}return null}var f,u=o(mr),s=o(dr),c=null;return sn(u)&&sn(s)?(c=l.program(s.id,u.id,null,n),f=cn(function(e,t){return e.link(c)})):f=new un(u&&u.thisDep||s&&s.thisDep,u&&u.contextDep||s&&s.contextDep,u&&u.propDep||s&&s.propDep,function(e,t){var r,n=e.shared.shader;r=u?u.append(e,t):t.def(n,".",mr);
48var a=n+".program("+(s?s.append(e,t):t.def(n,".",dr))+","+r;return S.optional(function(){a+=","+e.command}),t.def(a+")")}),{frag:u,vert:s,progVar:f,program:c}}(e,0,h);function E(e){var t=x[e];t&&(A[e]=t)}E(sr),E(T(ur));var D=Object.keys(A).length>0,j={framebuffer:y,draw:w,shader:O,state:A,dirty:D,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(j.profile=function(e){var t,r=e.static,n=e.dynamic;if(cr in r){var a=!!r[cr];(t=cn(function(e,t){return a})).enable=a}else if(cr in n){var i=n[cr];t=ln(i,function(e,t){return e.invoke(t,i)})}return t}(e),j.uniforms=function(e,t){var r=e.static,n=e.dynamic,a={};return Object.keys(r).forEach(function(e){var n,i=r[e];if("number"==typeof i||"boolean"==typeof i)n=cn(function(){return i});else if("function"==typeof i){var o=i._reglType;"texture2d"===o||"textureCube"===o?n=cn(function(e){return e.link(i)}):"framebuffer"===o||"framebufferCube"===o?(S.command(i.color.length>0,'missing color attachment for framebuffer sent to uniform "'+e+'"',t.commandStr),n=cn(function(e){return e.link(i.color[0])})):S.commandRaise('invalid data for uniform "'+e+'"',t.commandStr)}else he(i)?n=cn(function(t){return t.global.def("[",P(i.length,function(r){return S.command("number"==typeof i[r]||"boolean"==typeof i[r],"invalid uniform "+e,t.commandStr),i[r]}),"]")}):S.commandRaise('invalid or missing data for uniform "'+e+'"',t.commandStr);n.value=i,a[e]=n}),Object.keys(n).forEach(function(e){var t=n[e];a[e]=ln(t,function(e,r){return e.invoke(r,t)})}),a}(f,d),j.drawVAO=j.scopeVAO=w.vao,!j.drawVAO&&O.program&&!h&&n.angle_instanced_arrays&&w.static.elements){var C=!0,z=O.program.attributes.map(function(e){var r=t.static[e];return C=C&&!!r,r});if(C&&z.length>0){var F=c.getVAO(c.createVAO({attributes:z,elements:w.static.elements}));j.drawVAO=new un(null,null,null,function(e,t){return e.link(F)}),j.useVAO=!0}}return h?j.useVAO=!0:j.attributes=function(e,t){var n=e.static,a=e.dynamic,o={};return Object.keys(n).forEach(function(e){var a=n[e],f=r.id(e),u=new b;if(on(a))u.state=1,u.buffer=i.getBuffer(i.create(a,jr,!1,!0)),u.type=0;else{var s=i.getBuffer(a);if(s)u.state=1,u.buffer=s,u.type=0;else if(S.command("object"==typeof a&&a,"invalid data for attribute "+e,t.commandStr),"constant"in a){var c=a.constant;u.buffer="null",u.state=2,"number"==typeof c?u.x=c:(S.command(he(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+e,t.commandStr),It.forEach(function(e,t){t<c.length&&(u[e]=c[t])}))}else{s=on(a.buffer)?i.getBuffer(i.create(a.buffer,jr,!1,!0)):i.getBuffer(a.buffer),S.command(!!s,'missing buffer for attribute "'+e+'"',t.commandStr);var l=0|a.offset;S.command(l>=0,'invalid offset for attribute "'+e+'"',t.commandStr);var d=0|a.stride;S.command(d>=0&&d<256,'invalid stride for attribute "'+e+'", must be integer betweeen [0, 255]',t.commandStr);var m=0|a.size;S.command(!("size"in a)||m>0&&m<=4,'invalid size for attribute "'+e+'", must be 1,2,3,4',t.commandStr);var p=!!a.normalized,h=0;"type"in a&&(S.commandParameter(a.type,K,"invalid type for attribute "+e,t.commandStr),h=K[a.type]);var v=0|a.divisor;S.optional(function(){"divisor"in a&&(S.command(0===v||g,'cannot specify divisor for attribute "'+e+'", instancing not supported',t.commandStr),S.command(v>=0,'invalid divisor for attribute "'+e+'"',t.commandStr));var r=t.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(a).forEach(function(t){S.command(n.indexOf(t)>=0,'unknown parameter "'+t+'" for attribute pointer "'+e+'" (valid parameters are '+n+")",r)})}),u.buffer=s,u.state=1,u.size=m,u.normalized=p,u.type=h||s.dtype,u.offset=l,u.stride=d,u.divisor=v}}o[e]=cn(function(e,t){var r=e.attribCache;if(f in r)return r[f];var n={isStream:!1};return Object.keys(u).forEach(function(e){n[e]=u[e]}),u.buffer&&(n.buffer=e.link(u.buffer),n.type=n.type||n.buffer+".dtype"),r[f]=n,n})}),Object.keys(a).forEach(function(e){var t=a[e];o[e]=ln(t,function(r,n){var a=r.invoke(n,t),i=r.shared,o=r.constants,f=i.isBufferArgs,u=i.buffer;S.optional(function(){r.assert(n,a+"&&(typeof "+a+'==="object"||typeof '+a+'==="function")&&('+f+"("+a+")||"+u+".getBuffer("+a+")||"+u+".getBuffer("+a+".buffer)||"+f+"("+a+'.buffer)||("constant" in '+a+"&&(typeof "+a+'.constant==="number"||'+i.isArrayLike+"("+a+".constant))))",'invali
48d dynamic attribute "'+e+'"')});var s={isStream:n.def(!1)},c=new b;c.state=1,Object.keys(c).forEach(function(e){s[e]=n.def(""+c[e])});var l=s.buffer,d=s.type;function m(e){n(s[e],"=",a,".",e,"|0;")}return n("if(",f,"(",a,")){",s.isStream,"=true;",l,"=",u,".createStream(",jr,",",a,");",d,"=",l,".dtype;","}else{",l,"=",u,".getBuffer(",a,");","if(",l,"){",d,"=",l,".dtype;",'}else if("constant" in ',a,"){",s.state,"=",2,";","if(typeof "+a+'.constant === "number"){',s[It[0]],"=",a,".constant;",It.slice(1).map(function(e){return s[e]}).join("="),"=0;","}else{",It.map(function(e,t){return s[e]+"="+a+".constant.length>"+t+"?"+a+".constant["+t+"]:0;"}).join(""),"}}else{","if(",f,"(",a,".buffer)){",l,"=",u,".createStream(",jr,",",a,".buffer);","}else{",l,"=",u,".getBuffer(",a,".buffer);","}",d,'="type" in ',a,"?",o.glTypes,"[",a,".type]:",l,".dtype;",s.normalized,"=!!",a,".normalized;"),m("size"),m("offset"),m("stride"),m("divisor"),n("}}"),n.exit("if(",s.isStream,"){",u,".destroyStream(",l,");","}"),s})}),o}(t,d),j.context=function(e){var t=e.static,r=e.dynamic,n={};return Object.keys(t).forEach(function(e){var r=t[e];n[e]=cn(function(e,t){return"number"==typeof r||"boolean"==typeof r?""+r:e.link(r)})}),Object.keys(r).forEach(function(e){var t=r[e];n[e]=ln(t,function(e,r){return e.invoke(r,t)})}),n}(s),j}function L(e,t,r){var n=e.shared.context,a=e.scope();Object.keys(r).forEach(function(i){t.save(n,"."+i);var o=r[i].append(e,t);Array.isArray(o)?a(n,".",i,"=[",o.join(),"];"):a(n,".",i,"=",o,";")}),t(a)}function R(e,t,r,n){var a,i=e.shared,o=i.gl,f=i.framebuffer;y&&(a=t.def(i.extensions,".webgl_draw_buffers"));var u,s=e.constants,c=s.drawBuffer,l=s.backBuffer;u=r?r.append(e,t):t.def(f,".next"),n||t("if(",u,"!==",f,".cur){"),t("if(",u,"){",o,".bindFramebuffer(",36160,",",u,".framebuffer);"),y&&t(a,".drawBuffersWEBGL(",c,"[",u,".colorAttachments.length]);"),t("}else{",o,".bindFramebuffer(",36160,",null);"),y&&t(a,".drawBuffersWEBGL(",l,");"),t("}",f,".cur=",u,";"),n||t("}")}function M(e,t,r){var n=e.shared,a=n.gl,i=e.current,o=e.next,f=n.current,u=n.next,s=e.cond(f,".dirty");k.forEach(function(t){var n,c,l=T(t);if(!(l in r.state))if(l in o){n=o[l],c=i[l];var d=P(w[l].length,function(e){return s.def(n,"[",e,"]")});s(e.cond(d.map(function(e,t){return e+"!=="+c+"["+t+"]"}).join("||")).then(a,".",E[l],"(",d,");",d.map(function(e,t){return c+"["+t+"]="+e}).join(";"),";"))}else{n=s.def(u,".",l);var m=e.cond(n,"!==",f,".",l);s(m),l in O?m(e.cond(n).then(a,".enable(",O[l],");").else(a,".disable(",O[l],");"),f,".",l,"=",n,";"):m(a,".",E[l],"(",n,");",f,".",l,"=",n,";")}}),0===Object.keys(r.state).length&&s(f,".dirty=false;"),t(s)}function U(e,t,r,n){var a=e.shared,i=e.current,o=a.current,f=a.gl;fn(Object.keys(r)).forEach(function(a){var u=r[a];if(!n||n(u)){var s=u.append(e,t);if(O[a]){var c=O[a];sn(u)?t(f,s?".enable(":".disable(",c,");"):t(e.cond(s).then(f,".enable(",c,");").else(f,".disable(",c,");")),t(o,".",a,"=",s,";")}else if(he(s)){var l=i[a];t(f,".",E[a],"(",s,");",s.map(function(e,t){return l+"["+t+"]="+e}).join(";"),";")}else t(f,".",E[a],"(",s,");",o,".",a,"=",s,";")}})}function W(e,t){g&&(e.instancing=t.def(e.shared.extensions,".angle_instanced_arrays"))}function G(e,t,r,n,a){var i,o,f,u=e.shared,s=e.stats,c=u.current,l=u.timer,d=r.profile;function m(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function h(e){e(i=t.def(),"=",m(),";"),"string"==typeof a?e(s,".count+=",a,";"):e(s,".count++;"),p&&(n?e(o=t.def(),"=",l,".getNumPendingQueries();"):e(l,".beginQuery(",s,");"))}function b(e){e(s,".cpuTime+=",m(),"-",i,";"),p&&(n?e(l,".pushScopeStats(",o,",",l,".getNumPendingQueries(),",s,");"):e(l,".endQuery();"))}function v(e){var r=t.def(c,".profile");t(c,".profile=",e,";"),t.exit(c,".profile=",r,";")}if(d){if(sn(d))return void(d.enable?(h(t),b(t.exit),v("true")):v("false"));v(f=d.append(e,t))}else f=t.def(c,".profile");var g=e.block();h(g),t("if(",f,"){",g,"}");var y=e.block();b(y),t.exit("if(",f,"){",y,"}")}function H(e,t,r,n,a){var i=e.shared;n.forEach(function(n){var o,f=n.name,u=r.attributes[f];if(u){if(!a(u))return;o=u.append(e,t)}else{if(!a(dn))return;var s=e.scopeAttrib(f);S.optional(function(){e.assert(t,s+".state","missing attribute "+f)}),o={},Object.keys(new b).forEach(function(e){o[e]=t.def(s,".",e)})}!function(r,n,a){var o=i.gl,f=t.def(r,".location"),u=t.def(i.attributes,"[",f,"]"),s=a.state,c=a.buffer,l=[a.x,a.y,a.z,a.w],d=["buffer","normalized","offset","stride"];function m(){t("if(!",u,".buffer){",o,".enableVertexAttribArray(",f,");}");var r,i=a.type;if(r=a.size?t.def(a.size,"||",n):n,t("if(",u,".type!==",i,"||",u,".size!==",r,"||",d.map(function(e){return u+"."+e+"!=="+a[e]}).join("||"),"){",o,".bindBuffer(",jr,",",c,".buffer);",o,".vertexAttribPointer(",[f,r,i,a.normalized,a.stride,a.offset],");",u,".type=",i,";",u,".size=",r,";",d.map(function(e){return u+"."+e+"="+a[e]+";"}).join(""),"}"),g){var s=a.divisor;t("if(",u,".divisor!==",s,"){",e.instancing,".vertexAttribDivisorANGLE(",[f,s],");",u,".divisor=",s,";}")}}function p(){t("if(",u,".buffer){",o,".disableVertexAttribArray(",f,");",u,".buffer=null;","}if(",It.map(function(e,t){return u+"."+e+"!=="+l[t]}
48).join("||"),"){",o,".vertexAttrib4f(",f,",",l,");",It.map(function(e,t){return u+"."+e+"="+l[t]+";"}).join(""),"}")}1===s?m():2===s?p():(t("if(",s,"===",1,"){"),m(),t("}else{"),p(),t("}"))}(e.link(n),function(e){switch(e){case Fr:case Pr:case Ur:return 2;case Vr:case Lr:case Wr:return 3;case Br:case Rr:case Gr:return 4;default:return 1}}(n.info.type),o)})}function N(e,t,n,a,i,o){for(var f,u=e.shared,s=u.gl,c={},l=0;l<a.length;++l){var d=a[l],m=d.name,p=d.info.type,h=d.info.size,b=n.uniforms[m];if(h>1){if(!b)continue;var v=m.replace("[0]","");if(c[v])continue;c[v]=1}var g,y=e.link(d)+".location";if(b){if(!i(b))continue;if(sn(b)){var x=b.value;if(S.command(null!=x,'missing uniform "'+m+'"',e.commandStr),p===Qr||p===Yr){S.command("function"==typeof x&&(p===Qr&&("texture2d"===x._reglType||"framebuffer"===x._reglType)||p===Yr&&("textureCube"===x._reglType||"framebufferCube"===x._reglType)),"invalid texture for uniform "+m,e.commandStr);var w=e.link(x._texture||x.color[0]._texture);t(s,".uniform1i(",y,",",w+".bind());"),t.exit(w,".unbind();")}else if(p===Hr||p===Nr||p===qr){S.optional(function(){S.command(he(x),"invalid matrix for uniform "+m,e.commandStr),S.command(p===Hr&&4===x.length||p===Nr&&9===x.length||p===qr&&16===x.length,"invalid length for matrix uniform "+m,e.commandStr)});var A=e.global.def("new Float32Array(["+Array.prototype.slice.call(x)+"])"),k=2;p===Nr?k=3:p===qr&&(k=4),t(s,".uniformMatrix",k,"fv(",y,",false,",A,");")}else{switch(p){case zr:1===h?S.commandType(x,"number","uniform "+m,e.commandStr):S.command(he(x)&&x.length===h,"uniform "+m,e.commandStr),f="1f";break;case Fr:S.command(he(x)&&x.length&&x.length%2==0&&x.length<=2*h,"uniform "+m,e.commandStr),f="2f";break;case Vr:S.command(he(x)&&x.length&&x.length%3==0&&x.length<=3*h,"uniform "+m,e.commandStr),f="3f";break;case Br:S.command(he(x)&&x.length&&x.length%4==0&&x.length<=4*h,"uniform "+m,e.commandStr),f="4f";break;case Mr:1===h?S.commandType(x,"boolean","uniform "+m,e.commandStr):S.command(he(x)&&x.length===h,"uniform "+m,e.commandStr),f="1i";break;case Ir:1===h?S.commandType(x,"number","uniform "+m,e.commandStr):S.command(he(x)&&x.length===h,"uniform "+m,e.commandStr),f="1i";break;case Ur:case Pr:S.command(he(x)&&x.length&&x.length%2==0&&x.length<=2*h,"uniform "+m,e.commandStr),f="2i";break;case Wr:case Lr:S.command(he(x)&&x.length&&x.length%3==0&&x.length<=3*h,"uniform "+m,e.commandStr),f="3i";break;case Gr:case Rr:S.command(he(x)&&x.length&&x.length%4==0&&x.length<=4*h,"uniform "+m,e.commandStr),f="4i"}h>1?(f+="v",x=e.global.def("["+Array.prototype.slice.call(x)+"]")):x=he(x)?Array.prototype.slice.call(x):x,t(s,".uniform",f,"(",y,",",x,");")}continue}g=b.append(e,t)}else{if(!i(dn))continue;g=t.def(u.uniforms,"[",r.id(m),"]")}p===Qr?(S(!Array.isArray(g),"must specify a scalar prop for textures"),t("if(",g,"&&",g,'._reglType==="framebuffer"){',g,"=",g,".color[0];","}")):p===Yr&&(S(!Array.isArray(g),"must specify a scalar prop for cube maps"),t("if(",g,"&&",g,'._reglType==="framebufferCube"){',g,"=",g,".color[0];","}")),S.optional(function(){function r(r,n){e.assert(t,r,'bad data or missing for uniform "'+m+'". '+n)}function n(e,t){1===t&&S(!Array.isArray(g),"must not specify an array type for uniform"),r("Array.isArray("+g+") && typeof "+g+'[0]===" '+e+'" || typeof '+g+'==="'+e+'"',"invalid type, expected "+e)}function a(t,n,a){Array.isArray(g)?S(g.length&&g.length%t===0&&g.length<=t*a,"must have length of "+(1===a?"":"n * ")+t):r(u.isArrayLike+"("+g+")&&"+g+".length && "+g+".length % "+t+" === 0 && "+g+".length<="+t*a,"invalid vector, should have length of "+(1===a?"":"n * ")+t,e.commandStr)}function i(t){S(!Array.isArray(g),"must not specify a value type"),r("typeof "+g+'==="function"&&'+g+'._reglType==="texture'+(3553===t?"2d":"Cube")+'"',"invalid texture type",e.commandStr)}switch(p){case Ir:n("number",h);break;case Pr:a(2,0,h);break;case Lr:a(3,0,h);break;case Rr:a(4,0,h);break;case zr:n("number",h);break;case Fr:a(2,0,h);break;case Vr:a(3,0,h);break;case Br:a(4,0,h);break;case Mr:n("boolean",h);break;case Ur:a(2,0,h);break;case Wr:a(3,0,h);break;case Gr:case Hr:a(4,0,h);break;case Nr:a(9,0,h);break;
48case qr:a(16,0,h);break;case Qr:i(3553);break;case Yr:i(34067)}});var O=1;switch(p){case Qr:case Yr:var E=t.def(g,"._texture");t(s,".uniform1i(",y,",",E,".bind());"),t.exit(E,".unbind();");continue;case Ir:case Mr:f="1i";break;case Pr:case Ur:f="2i",O=2;break;case Lr:case Wr:f="3i",O=3;break;case Rr:case Gr:f="4i",O=4;break;case zr:f="1f";break;case Fr:f="2f",O=2;break;case Vr:f="3f",O=3;break;case Br:f="4f",O=4;break;case Hr:f="Matrix2fv";break;case Nr:f="Matrix3fv";break;case qr:f="Matrix4fv"}if(-1===f.indexOf("Matrix")&&h>1&&(f+="v",O=1),"M"===f.charAt(0)){t(s,".uniform",f,"(",y,",");var T=Math.pow(p-Hr+2,2),D=e.global.def("new Float32Array(",T,")");Array.isArray(g)?t("false,(",P(T,function(e){return D+"["+e+"]="+g[e]}),",",D,")"):t("false,(Array.isArray(",g,")||",g," instanceof Float32Array)?",g,":(",P(T,function(e){return D+"["+e+"]="+g+"["+e+"]"}),",",D,")"),t(");")}else if(O>1){for(var j=[],C=[],z=0;z<O;++z)Array.isArray(g)?C.push(g[z]):C.push(t.def(g+"["+z+"]")),o&&j.push(t.def());o&&t("if(!",e.batchId,"||",j.map(function(e,t){return e+"!=="+C[t]}).join("||"),"){",j.map(function(e,t){return e+"="+C[t]+";"}).join("")),t(s,".uniform",f,"(",y,",",C.join(","),");"),o&&t("}")}else{if(S(!Array.isArray(g),"uniform value must not be an array"),o){var F=t.def();t("if(!",e.batchId,"||",F,"!==",g,"){",F,"=",g,";")}t(s,".uniform",f,"(",y,",",g,");"),o&&t("}")}}}function q(e,t,r,n){var a=e.shared,i=a.gl,o=a.draw,f=n.draw,u=function(){var u,s=f.elements,c=t;return s?((s.contextDep&&n.contextDynamic||s.propDep)&&(c=r),u=s.append(e,c),f.elementsActive&&c("if("+u+")"+i+".bindBuffer("+Cr+","+u+".buffer.buffer);")):(u=c.def(),c(u,"=",o,".",pr,";","if(",u,"){",i,".bindBuffer(",Cr,",",u,".buffer.buffer);}","else if(",a.vao,".currentVAO){",u,"=",e.shared.elements+".getElements("+a.vao,".currentVAO.elements);",x?"":"if("+u+")"+i+".bindBuffer("+Cr+","+u+".buffer.buffer);","}")),u}();function s(a){var i=f[a];return i?i.contextDep&&n.contextDynamic||i.propDep?i.append(e,r):i.append(e,t):t.def(o,".",a)}var c,l,d=s(hr),m=s(vr),p=function(){var a,i=f.count,u=t;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(u=r),a=i.append(e,u),S.optional(function(){i.MISSING&&e.assert(t,"false","missing vertex count"),i.DYNAMIC&&e.assert(u,a+">=0","missing vertex count")})):(a=u.def(o,".",br),S.optional(function(){e.assert(u,a+">=0","missing vertex count")})),a}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");g&&(c=s(gr),l=e.instancing);var h=u+".type",b=f.elements&&sn(f.elements)&&!f.vaoActive;function v(){function e(){r(l,".drawElementsInstancedANGLE(",[d,p,h,m+"<<(("+h+"-5121)>>1)",c],");")}function t(){r(l,".drawArraysInstancedANGLE(",[d,m,p,c],");")}u&&"null"!==u?b?e():(r("if(",u,"){"),e(),r("}else{"),t(),r("}")):t()}function y(){function e(){r(i+".drawElements("+[d,p,h,m+"<<(("+h+"-5121)>>1)"]+");")}function t(){r(i+".drawArrays("+[d,m,p]+");")}u&&"null"!==u?b?e():(r("if(",u,"){"),e(),r("}else{"),t(),r("}")):t()}g&&("number"!=typeof c||c>=0)?"string"==typeof c?(r("if(",c,">0){"),v(),r("}else if(",c,"<0){"),y(),r("}")):v():y()}function Q(e,t,r,n,a){var i=B(),o=i.proc("body",a);return S.optional(function(){i.commandStr=t.commandStr,i.command=i.link(t.commandStr)}),g&&(i.instancing=o.def(i.shared.extensions,".angle_instanced_arrays")),e(i,o,r,n),i.compile().body}function Y(e,t,r,n){W(e,t),r.useVAO?r.drawVAO?t(e.shared.vao,".setVAO(",r.drawVAO.append(e,t),");"):t(e.shared.vao,".setVAO(",e.shared.vao,".targetVAO);"):(t(e.shared.vao,".setVAO(null);"),H(e,t,r,n.attributes,function(){return!0})),N(e,t,r,n.uniforms,function(){return!0},!1),q(e,t,t,r)}function X(e,t,r,n){function a(){return!0}e.batchId="a1",W(e,t),H(e,t,r,n.attributes,a),N(e,t,r,n.uniforms,a,!1),q(e,t,t,r)}function $(e,t,r,n){W(e,t);var a=r.contextDep,i=t.def(),o=t.def();e.shared.props=o,e.batchId=i;var f=e.scope(),u=e.scope();function s(e){return e.contextDep&&a||e.propDep}function c(e){return!s(e)}if(t(f.entry,"for(",i,"=0;",i,"<","a1",";++",i,"){",o,"=","a0","[",i,"];",u,"}",f.exit),r.needsContext&&L(e,u,r.context),r.needsFramebuffer&&R(e,u,r.framebuffer),U(e,u,r.state,s),r.profile&&s(r.profile)&&G(e,u,r,!1,!0),n)r.useVAO?r.drawVAO?s(r.drawVAO)?u(e.shared.vao,".setVAO(",r.drawVAO.append(e,u),");"):f(e.shared.vao,".setVAO(",r.drawVAO.append(e,f),");"):f(e.shared.vao,".setVAO(",e.shared.vao,".targetVAO);"):(f(e.shared.vao,".setVAO(null);
48"),H(e,f,r,n.attributes,c),H(e,u,r,n.attributes,s)),N(e,f,r,n.uniforms,c,!1),N(e,u,r,n.uniforms,s,!0),q(e,f,u,r);else{var l=e.global.def("{}"),d=r.shader.progVar.append(e,u),m=u.def(d,".id"),p=u.def(l,"[",m,"]");u(e.shared.gl,".useProgram(",d,".program);","if(!",p,"){",p,"=",l,"[",m,"]=",e.link(function(t){return Q(X,e,r,t,2)}),"(",d,");}",p,".call(this,a0[",i,"],",i,");")}}function J(e,t,r){var n=t.static[r];if(n&&function(e){if("object"==typeof e&&!he(e)){for(var t=Object.keys(e),r=0;r<t.length;++r)if(C.isDynamic(e[t[r]]))return!0;return!1}}(n)){var a=e.global,i=Object.keys(n),o=!1,f=!1,u=!1,s=e.global.def("{}");i.forEach(function(t){var r=n[t];if(C.isDynamic(r)){"function"==typeof r&&(r=n[t]=C.unbox(r));var i=ln(r,null);o=o||i.thisDep,u=u||i.propDep,f=f||i.contextDep}else{switch(a(s,".",t,"="),typeof r){case"number":a(r);break;case"string":a('"',r,'"');break;case"object":Array.isArray(r)&&a("[",r.join(),"]");break;default:a(e.link(r))}a(";")}}),t.dynamic[r]=new C.DynamicVariable(4,{thisDep:o,contextDep:f,propDep:u,ref:s,append:function(e,t){i.forEach(function(r){var a=n[r];if(C.isDynamic(a)){var i=e.invoke(t,a);t(s,".",r,"=",i,";")}})}}),delete t.static[r]}}return{next:A,current:w,procs:function(){var e=B(),t=e.proc("poll"),r=e.proc("refresh"),i=e.block();t(i),r(i);var o,f=e.shared,u=f.gl,s=f.next,c=f.current;i(c,".dirty=false;"),R(e,t),R(e,r,null,!0),g&&(o=e.link(g)),n.oes_vertex_array_object&&r(e.link(n.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var l=0;l<a.maxAttributes;++l){var d=r.def(f.attributes,"[",l,"]"),m=e.cond(d,".buffer");m.then(u,".enableVertexAttribArray(",l,");",u,".bindBuffer(",jr,",",d,".buffer.buffer);",u,".vertexAttribPointer(",l,",",d,".size,",d,".type,",d,".normalized,",d,".stride,",d,".offset);").else(u,".disableVertexAttribArray(",l,");",u,".vertexAttrib4f(",l,",",d,".x,",d,".y,",d,".z,",d,".w);",d,".buffer=null;"),r(m),g&&r(o,".vertexAttribDivisorANGLE(",l,",",d,".divisor);")}return r(e.shared.vao,".currentVAO=null;",e.shared.vao,".setVAO(",e.shared.vao,".targetVAO);"),Object.keys(O).forEach(function(n){var a=O[n],o=i.def(s,".",n),f=e.block();f("if(",o,"){",u,".enable(",a,")}else{",u,".disable(",a,")}",c,".",n,"=",o,";"),r(f),t("if(",o,"!==",c,".",n,"){",f,"}")}
48),Object.keys(E).forEach(function(n){var a,o,f=E[n],l=w[n],d=e.block();if(d(u,".",f,"("),he(l)){var m=l.length;a=e.global.def(s,".",n),o=e.global.def(c,".",n),d(P(m,function(e){return a+"["+e+"]"}),");",P(m,function(e){return o+"["+e+"]="+a+"["+e+"];"}).join("")),t("if(",P(m,function(e){return a+"["+e+"]!=="+o+"["+e+"]"}).join("||"),"){",d,"}")}else a=i.def(s,".",n),o=i.def(c,".",n),d(a,");",c,".",n,"=",a,";"),t("if(",a,"!==",o,"){",d,"}");r(d)}),e.compile()}(),compile:function(e,n,a,i,o){var f=B();f.stats=f.link(o),Object.keys(n.static).forEach(function(e){J(f,n,e)}),Dr.forEach(function(t){J(f,e,t)});var u=I(e,n,a,i,f);return function(e,t){var r=e.proc("draw",1);W(e,r),L(e,r,t.context),R(e,r,t.framebuffer),M(e,r,t),U(e,r,t.state),G(e,r,t,!1,!0);var n=t.shader.progVar.append(e,r);if(r(e.shared.gl,".useProgram(",n,".program);"),t.shader.program)Y(e,r,t,t.shader.program);else{r(e.shared.vao,".setVAO(null);");var a=e.global.def("{}"),i=r.def(n,".id"),o=r.def(a,"[",i,"]");r(e.cond(o).then(o,".call(this,a0);").else(o,"=",a,"[",i,"]=",e.link(function(r){return Q(Y,e,t,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(t.state).length>0&&r(e.shared.current,".dirty=true;"),e.shared.vao&&r(e.shared.vao,".setVAO(null);")}(f,u),function(e,t){var n=e.proc("scope",3);e.batchId="a2";var a=e.shared,i=a.current;function o(r){var i=t.shader[r];i&&n.set(a.shader,"."+r,i.append(e,n))}L(e,n,t.context),t.framebuffer&&t.framebuffer.append(e,n),fn(Object.keys(t.state)).forEach(function(r){var i=t.state[r].append(e,n);he(i)?i.forEach(function(t,a){n.set(e.next[r],"["+a+"]",t)}):n.set(a.next,"."+r,i)}),G(e,n,t,!0,!0),[pr,vr,br,gr,hr].forEach(function(r){var i=t.draw[r];i&&n.set(a.draw,"."+r,""+i.append(e,n))}),Object.keys(t.uniforms).forEach(function(i){var o=t.uniforms[i].append(e,n);Array.isArray(o)&&(o="["+o.join()+"]"),n.set(a.uniforms,"["+r.id(i)+"]",o)}),Object.keys(t.attributes).forEach(function(r){var a=t.attributes[r].append(e,n),i=e.scopeAttrib(r);Object.keys(new b).forEach(function(e){n.set(i,"."+e,a[e])})}),t.scopeVAO&&n.set(a.vao,".targetVAO",t.scopeVAO.append(e,n)),o(dr),o(mr),Object.keys(t.state).length>0&&(n(i,".dirty=true;"),n.exit(i,".dirty=true;")),n("a1(",e.shared.context,",a0,",e.batchId,");")}(f,u),function(e,t){var r=e.proc("batch",2);e.batchId="0",W(e,r);var n=!1,a=!0;Object.keys(t.context).forEach(function(e){n=n||t.context[e].propDep}),n||(L(e,r,t.context),a=!1);var i=t.framebuffer,o=!1;function f(e){return e.contextDep&&n||e.propDep}i?(i.propDep?n=o=!0:i.contextDep&&n&&(o=!0),o||R(e,r,i)):R(e,r,null),t.state.viewport&&t.state.viewport.propDep&&(n=!0),M(e,r,t),U(e,r,t.state,function(e){return!f(e)}),t.profile&&f(t.profile)||G(e,r,t,!1,"a1"),t.contextDep=n,t.needsContext=a,t.needsFramebuffer=o;var u=t.shader.progVar;if(u.contextDep&&n||u.propDep)$(e,r,t,null);else{var s=u.append(e,r);if(r(e.shared.gl,".useProgram(",s,".program);"),t.shader.program)$(e,r,t,t.shader.program);else{r(e.shared.vao,".setVAO(null);");var c=e.global.def("{}"),l=r.def(s,".id"),d=r.def(c,"[",l,"]");r(e.cond(d).then(d,".call(this,a0,a1);").else(d,"=",c,"[",l,"]=",e.link(function(r){return Q($,e,t,r,2)}),"(",s,");",d,".call(this,a0,a1);"))}}Object.keys(t.state).length>0&&r(e.shared.current,".dirty=true;"),e.shared.vao&&r(e.shared.vao,".setVAO(null);")}(f,u),t(f.compile(),{destroy:function(){u.shader.program.destroy()}})}}}var pn=function(e,t){if(!t.ext_disjoint_timer_query)return null;var r=[];function n(e){r.push(e)}var a=[];function i(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var o=[];function f(e){o.push(e)}var u=[];function s(e,t,r){var n=o.pop()||new i;n.startQueryIndex=e,n.endQueryIndex=t,n.sum=0,n.stats=r,u.push(n)}var c=[],l=[];return{beginQuery:function(e){var n=r.pop()||t.ext_disjoint_timer_query.createQueryEXT();t.ext_disjoint_timer_query.beginQueryEXT(35007,n),a.push(n),s(a.length-1,a.length,e)},endQuery:function(){t.ext_disjoint_timer_query.endQueryEXT(35007)},pushScopeStats:s,update:function(){var e,r,i=a.length;if(0!==i){l.length=Math.max(l.length,i+1),c.length=Math.max(c.length,i+1),c[0]=0,l[0]=0;var o=0;for(e=0,r=0;r<a.length;++r){var s=a[r];t.ext_disjoint_timer_query.getQueryObjectEXT(s,34919)?(o+=t.ext_disjoint_timer_query.getQueryObjectEXT(s,34918),n(s)):a[e++]=s,c[r+1]=o,l[r+1]=e}for(a.length=e,e=0,r=0;r<u.length;++r){var d=u[r],m=d.startQueryIndex,p=d.endQueryIndex;d.sum+=c[p]-c[m];var h=l[m],b=l[p];b===h?(d.stats.gpuTime+=d.sum/1e6,f(d)):(d.startQueryIndex=h,d.endQueryIndex=b,u[e++]=d)}u.length=e}},getNumPendingQueries:function(){return a.length},clear:function(){r.push.apply(r,a);for(var e=0;e<r.length;e++)t.ext_disjoint_timer_query.deleteQueryEXT(r[e]);a.length=0,r.length=0},restore:function(){a.length=0,r.length=0}}},hn="webglcontextlost",bn="webglcontextrestored";function vn(e,t){for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}return function(r){var n=I(r);if(!n)return null;var a=n.gl,i=a.getContextAttributes(),o=a.isContextLost(),f=function(e,t){var r={};function n(t){S.type(t,"string","extension name must be string");var n,a=t.toLowerCase();try{n=r[a]=e.getExtension(a)}catch(e){}return!!n}for(var a=0;a<t.extensions.length;++a){var i=t.extensions[a];if(!n(i))return t.onDestroy(),t.onDone('"'+i+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return t.optionalExtensions.forEach(n),{extensions:r,restore:function(){Object.keys(r).forEach(function(e){if(r[e]&&!n(e))throw new Error("(regl): error restoring extension "+e)})}}}(a,n);if(!f)return null;var u,s,c=(u={"":0},s=[""],{id:function(e){var t=u[e];return t||(t=u[e]=s.length,s.push(e),t)},str:function(e){return s[e]}}),l={vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},d=f.extensions,m=pn(0,d),p=F(),h=a.drawingBufferWidth,b=a.drawingBufferHeight,v={tick:0,time:0,viewportWidth:h,viewportHe
48ight:b,framebufferWidth:h,framebufferHeight:b,drawingBufferWidth:h,drawingBufferHeight:b,pixelRatio:n.pixelRatio},g={elements:null,primitive:4,count:-1,offset:0,instances:-1},y=function(e,t){var r=1;t.ext_texture_filter_anisotropic&&(r=e.getParameter(34047));var n=1,a=1;t.webgl_draw_buffers&&(n=e.getParameter(34852),a=e.getParameter(36063));var i=!!t.oes_texture_float;if(i){var o=e.createTexture();e.bindTexture(U,o),e.texImage2D(U,0,W,1,1,0,W,G,null);var f=e.createFramebuffer();if(e.bindFramebuffer(H,f),e.framebufferTexture2D(H,36064,U,o,0),e.bindTexture(U,null),36053!==e.checkFramebufferStatus(H))i=!1;else{e.viewport(0,0,1,1),e.clearColor(1,0,0,1),e.clear(16384);var u=M.allocType(G,4);e.readPixels(0,0,1,1,W,G,u),e.getError()?i=!1:(e.deleteFramebuffer(f),e.deleteTexture(o),i=1===u[0]),M.freeType(u)}}var s=!0;if("undefined"==typeof navigator||!(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent))){var c=e.createTexture(),l=M.allocType(5121,36);e.activeTexture(33984),e.bindTexture(34067,c),e.texImage2D(34069,0,W,3,3,0,W,5121,l),M.freeType(l),e.bindTexture(34067,null),e.deleteTexture(c),s=!e.getError()}return{colorBits:[e.getParameter(3410),e.getParameter(3411),e.getParameter(3412),e.getParameter(3413)],depthBits:e.getParameter(3414),stencilBits:e.getParameter(3415),subpixelBits:e.getParameter(3408),extensions:Object.keys(t).filter(function(e){return!!t[e]}),maxAnisotropic:r,maxDrawbuffers:n,maxColorAttachments:a,pointSizeDims:e.getParameter(33901),lineWidthDims:e.getParameter(33902),maxViewportDims:e.getParameter(3386),maxCombinedTextureUnits:e.getParameter(35661),maxCubeMapSize:e.getParameter(34076),maxRenderbufferSize:e.getParameter(34024),maxTextureUnits:e.getParameter(34930),maxTextureSize:e.getParameter(3379),maxAttributes:e.getParameter(34921),maxVertexUniforms:e.getParameter(36347),maxVertexTextureUnits:e.getParameter(35660),maxVaryingVectors:e.getParameter(36348),maxFragmentUniforms:e.getParameter(36349),glsl:e.getParameter(35724),renderer:e.getParameter(7937),vendor:e.getParameter(7936),version:e.getParameter(7938),readFloat:i,npotTextureCube:s}}(a,d),x=function(t,r,n,a){var i=0,o={};function f(e){this.id=i++,this.buffer=t.createBuffer(),this.type=e,this.usage=35044,this.byteLength=0,this.dimension=1,this.dtype=te,this.persistentData=null,n.profile&&(this.stats={size:0})}f.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},f.prototype.destroy=function(){l(this)};var u=[];function s(e,r,n){e.byteLength=r.byteLength,t.bufferData(e.type,r,n)}function c(t,r,n,a,i,o){var f,u;if(t.usage=n,Array.isArray(r)){if(t.dtype=a||re,r.length>0)if(Array.isArray(r[0])){f=ee(r);for(var c=1,l=1;l<f.length;++l)c*=f[l];t.dimension=c,s(t,u=Z(r,f,t.dtype),n),o?t.persistentData=u:M.freeType(u)}else if("number"==typeof r[0]){t.dimension=i;var d=M.allocType(t.dtype,r.length);ie(d,r),s(t,d,n),o?t.persistentData=d:M.freeType(d)}else e(r[0])?(t.dimension=r[0].length,t.dtype=a||ae(r[0])||re,s(t,u=Z(r,[r.length,r[0].length],t.dtype),n),o?t.persistentData=u:M.freeType(u)):S.raise("invalid buffer data")}else if(e(r))t.dtype=a||ae(r),t.dimension=i,s(t,r,n),o&&(t.persistentData=new Uint8Array(new Uint8Array(r.buffer)));else if(N(r)){f=r.shape;var m=r.stride,p=r.offset,h=0,b=0,v=0,g=0;1===f.length?(h=f[0],b=1,v=m[0],g=0):2===f.length?(h=f[0],b=f[1],v=m[0],g=m[1]):S.raise("invalid shape"),t.dtype=a||ae(r.data)||re,t.dimension=b;var y=M.allocType(t.dtype,h*b);oe(y,r.data,h,b,v,g,p),s(t,y,n),o?t.persistentData=y:M.freeType(y)}else r instanceof ArrayBuffer?(t.dtype=te,t.dimension=i,s(t,r,n),o&&(t.persistentData=new Uint8Array(new Uint8Array(r)))):S.raise("invalid buffer data")}function l(e){r.bufferCount--,a(e);var n=e.buffer;S(n,"buffer must not be deleted already"),t.deleteBuffer(n),e.buffer=null,delete o[e.id]}return n.profile&&(r.getTotalBufferSize=function(){var e=0;return Object.keys(o).forEach(function(t){e+=o[t].stats.size}),e}),{create:function(a,i,u,s){r.bufferCount++;var d=new f(i);function m(r){var a=35044,i=null,o=0,f=0,u=1;return Array.isArray(r)||e(r)||N(r)||r instanceof ArrayBuffer?i=r:"number"==typeof r?o=0|r:r&&(S.type(r,"object","buffer arguments must be an object, a number or an array"),"data"in r&&(S(null===i||Array.isArray(i)||e(i)||N(i),"invalid data for buffer"),i=r.data),"usage"in r&&(S.parameter(r.usage,J,"invali
48d buffer usage"),a=J[r.usage]),"type"in r&&(S.parameter(r.type,K,"invalid buffer type"),f=K[r.type]),"dimension"in r&&(S.type(r.dimension,"number","invalid dimension"),u=0|r.dimension),"length"in r&&(S.nni(o,"buffer length must be a nonnegative integer"),o=0|r.length)),d.bind(),i?c(d,i,a,f,u,s):(o&&t.bufferData(d.type,o,a),d.dtype=f||te,d.usage=a,d.dimension=u,d.byteLength=o),n.profile&&(d.stats.size=d.byteLength*ne[d.dtype]),m}function p(e,r){S(r+e.byteLength<=d.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+e.byteLength+" starting from offset "+r+" to a buffer of size "+d.byteLength),t.bufferSubData(d.type,r,e)}return o[d.id]=d,u||m(a),m._reglType="buffer",m._buffer=d,m.subdata=function(t,r){var n,a=0|(r||0);if(d.bind(),e(t)||t instanceof ArrayBuffer)p(t,a);else if(Array.isArray(t)){if(t.length>0)if("number"==typeof t[0]){var i=M.allocType(d.dtype,t.length);ie(i,t),p(i,a),M.freeType(i)}else if(Array.isArray(t[0])||e(t[0])){n=ee(t);var o=Z(t,n,d.dtype);p(o,a),M.freeType(o)}else S.raise("invalid buffer data")}else if(N(t)){n=t.shape;var f=t.stride,u=0,s=0,c=0,l=0;1===n.length?(u=n[0],s=1,c=f[0],l=0):2===n.length?(u=n[0],s=n[1],c=f[0],l=f[1]):S.raise("invalid shape");var h=Array.isArray(t.data)?d.dtype:ae(t.data),b=M.allocType(h,u*s);oe(b,t.data,u,s,c,l,t.offset),p(b,a),M.freeType(b)}else S.raise("invalid data for buffer subdata");return m},n.profile&&(m.stats=d.stats),m.destroy=function(){l(d)},m},createStream:function(e,t){var r=u.pop();return r||(r=new f(e)),r.bind(),c(r,t,35040,0,1,!1),r},destroyStream:function(e){u.push(e)},clear:function(){q(o).forEach(l),u.forEach(l)},getBuffer:function(e){return e&&e._buffer instanceof f?e._buffer:null},restore:function(){q(o).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})},_initBuffer:c}}(a,l,n,function(e){return A.destroyBuffer(e)}),w=function(t,r,n,a){var i={},o=0,f={uint8:ue,uint16:se};function u(e){this.id=o++,i[this.id]=this,this.buffer=e,this.primType=4,this.vertCount=0,this.type=0}r.oes_element_index_uint&&(f.uint32=ce),u.prototype.bind=function(){this.buffer.bind()};var s=[];function c(a,i,o,f,u,s,c){var l;if(a.buffer.bind(),i){var d=c;c||e(i)&&(!N(i)||e(i.data))||(d=r.oes_element_index_uint?ce:se),n._initBuffer(a.buffer,i,o,d,3)}else t.bufferData(le,s,o),a.buffer.dtype=l||ue,a.buffer.usage=o,a.buffer.dimension=3,a.buffer.byteLength=s;if(l=c,!c){switch(a.buffer.dtype){case ue:case 5120:l=ue;break;case se:case 5122:l=se;break;case ce:case 5124:l=ce;break;default:S.raise("unsupported type for element array")}a.buffer.dtype=l}a.type=l,S(l!==ce||!!r.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var m=u;m<0&&(m=a.buffer.byteLength,l===se?m>>=1:l===ce&&(m>>=2)),a.vertCount=m;var p=f;if(f<0){p=4;var h=a.buffer.dimension;1===h&&(p=0),2===h&&(p=1),3===h&&(p=4)}a.primType=p}function l(e){a.elementsCount--,S(null!==e.buffer,"must not double destroy elements"),delete i[e.id],e.buffer.destroy(),e.buffer=null}return{create:function(t,r){var i=n.create(null,le,!0),o=new u(i._buffer);function s(t){if(t)if("number"==typeof t)i(t),o.primType=4,o.vertCount=0|t,o.type=ue;else{var r=null,n=35044,a=-1,u=-1,l=0,d=0;Array.isArray(t)||e(t)||N(t)?r=t:(S.type(t,"object","invalid arguments for elements"),"data"in t&&(r=t.data,S(Array.isArray(r)||e(r)||N(r),"invalid data for element buffer")),"usage"in t&&(S.parameter(t.usage,J,"invalid element buffer usage"),n=J[t.usage]),"primitive"in t&&(S.parameter(t.primitive,fe,"invalid element buffer primitive"),a=fe[t.primitive]),"count"in t&&(S("number"==typeof t.count&&t.count>=0,"invalid vertex count for elements"),u=0|t.count),"type"in t&&(S.parameter(t.type,f,"invali
48d buffer type"),d=f[t.type]),"length"in t?l=0|t.length:(l=u,d===se||5122===d?l*=2:d!==ce&&5124!==d||(l*=4))),c(o,r,n,a,u,l,d)}else i(),o.primType=4,o.vertCount=0,o.type=ue;return s}return a.elementsCount++,s(t),s._reglType="elements",s._elements=o,s.subdata=function(e,t){return i.subdata(e,t),s},s.destroy=function(){l(o)},s},createStream:function(e){var t=s.pop();return t||(t=new u(n.create(null,le,!0,!1)._buffer)),c(t,e,35040,-1,-1,0,0),t},destroyStream:function(e){s.push(e)},getElements:function(e){return"function"==typeof e&&e._elements instanceof u?e._elements:null},clear:function(){q(i).forEach(l)}}}(a,d,x,l),A=function(t,r,n,a,i,o,f){for(var u=n.maxAttributes,s=new Array(u),c=0;c<u;++c)s[c]=new jt;var l=0,d={},m={Record:jt,scope:{},state:s,currentVAO:null,targetVAO:null,restore:p()?function(){p()&&q(d).forEach(function(e){e.refresh()})}:function(){},createVAO:function(t){var n=new b;function f(t){var a;if(Array.isArray(t))a=t,n.elements&&n.ownsElements&&n.elements.destroy(),n.elements=null,n.ownsElements=!1,n.offset=0,n.count=0,n.instances=-1,n.primitive=4;else{if(S("object"==typeof t,"invalid arguments for create vao"),S("attributes"in t,"must specify attributes for vao"),t.elements){var s=t.elements;n.ownsElements?"function"==typeof s&&"elements"===s._reglType?(n.elements.destroy(),n.ownsElements=!1):(n.elements(s),n.ownsElements=!1):o.getElements(t.elements)?(n.elements=t.elements,n.ownsElements=!1):(n.elements=o.create(t.elements),n.ownsElements=!0)}else n.elements=null,n.ownsElements=!1;a=t.attributes,n.offset=0,n.count=-1,n.instances=-1,n.primitive=4,n.elements&&(n.count=n.elements._elements.vertCount,n.primitive=n.elements._elements.primType),"offset"in t&&(n.offset=0|t.offset),"count"in t&&(n.count=0|t.count),"instances"in t&&(n.instances=0|t.instances),"primitive"in t&&(S(t.primitive in fe,"bad primitive type: "+t.primitive),n.primitive=fe[t.primitive]),S.optional(()=>{for(var e=Object.keys(t),r=0;r<e.length;++r)S(Dt.indexOf(e[r])>=0,'invalid option for vao: "'+e[r]+'" valid options are '+Dt)}),S(Array.isArray(a),"attributes must be an array")}S(a.length<u,"too many attributes"),S(a.length>0,"must specify at least one attribute");var c={},l=n.attributes;l.length=a.length;for(var d=0;d<a.length;++d){var m,p=a[d],h=l[d]=new jt,b=p.data||p;Array.isArray(b)||e(b)||N(b)?(n.buffers[d]&&(m=n.buffers[d],e(b)&&m._buffer.byteLength>=b.byteLength?m.subdata(b):(m.destroy(),n.buffers[d]=null)),n.buffers[d]||(m=n.buffers[d]=i.create(p,34962,!1,!0)),h.buffer=i.getBuffer(m),h.size=0|h.buffer.dimension,h.normalized=!1,h.type=h.buffer.dtype,h.offset=0,h.stride=0,h.divisor=0,h.state=1,c[d]=1):i.getBuffer(p)?(h.buffer=i.getBuffer(p),h.size=0|h.buffer.dimension,h.normalized=!1,h.type=h.buffer.dtype,h.offset=0,h.stride=0,h.divisor=0,h.state=1):i.getBuffer(p.buffer)?(h.buffer=i.getBuffer(p.buffer),h.size=0|(+p.size||h.buffer.dimension),h.normalized=!!p.normalized||!1,"type"in p?(S.parameter(p.type,K,"invalid buffer type"),h.type=K[p.type]):h.type=h.buffer.dtype,h.offset=0|(p.offset||0),h.stride=0|(p.stride||0),h.divisor=0|(p.divisor||0),h.state=1,S(h.size>=1&&h.size<=4,"size must be between 1 and 4"),S(h.offset>=0,"invalid offset"),S(h.stride>=0&&h.stride<=255,"stride must be between 0 and 255"),S(h.divisor>=0,"divisor must be positive"),S(!h.divisor||!!r.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in p?(S(d>0,"first attribute must not be a constant"),h.x=+p.x||0,h.y=+p.y||0,h.z=+p.z||0,h.w=+p.w||0,h.state=2):S(!1,"invalid attribute spec for location "+d)}for(var v=0;v<n.buffers.length;++v)!c[v]&&n.buffers[v]&&(n.buffers[v].destroy(),n.buffers[v]=null);return n.refresh(),f}return a.vaoCount+=1,f.destroy=function(){for(var e=0;e<n.buffers.length;++e)n.buffers[e]&&n.buffers[e].destroy();n.buffers.length=0,n.ownsElements&&(n.elements.destroy(),n.elements=null,n.ownsElements=!1),n.destroy()},f._vao=n,f._reglType="vao",f(t)},getVAO:function(e){return"function"==typeof e&&e._vao?e._vao:null},destroyBuffer:function(e){for(var r=0;r<s.length;++r){var n=s[r];n.buffer===e&&(t.disableVertexAttribArray(r),n.buffer=null)}},setVAO:p()?function(e){if(e!==m.currentVAO){var t=p();e?t.bindVertexArrayOES(e.vao):t.bindVertexArrayOES(null),m.currentVAO=e}}:function(e){if(e!==m.currentVAO){if(e)e.bindAttrs();else{for(var r=h(),n=0;n<s.length;++n){var a=s[n];a.buffer?(t.enableVertexAttribArray(n),a.buffer.bind(),t.vertexAttribPointer(n,a.size,a.type,a.normalized,a.stride,a.offfset),r&&a.divisor&&r.vertexAttribDivisorANGLE(n,a.divisor)):(t.disableVertexAttribArray(n),t.vertexAttrib4f(n,a.x,a.y,a.z,a.w))}f.elements?t.bindBuffer(Tt,f.elements.buffer.buffer):t.bindBuffer(Tt,null)}m.currentVAO=e}}
48,clear:p()?function(){q(d).forEach(function(e){e.destroy()})}:function(){}};function p(){return r.oes_vertex_array_object}function h(){return r.angle_instanced_arrays}function b(){this.id=++l,this.attributes=[],this.elements=null,this.ownsElements=!1,this.count=0,this.offset=0,this.instances=-1,this.primitive=4;var e=p();this.vao=e?e.createVertexArrayOES():null,d[this.id]=this,this.buffers=[]}return b.prototype.bindAttrs=function(){for(var e=h(),r=this.attributes,n=0;n<r.length;++n){var a=r[n];a.buffer?(t.enableVertexAttribArray(n),t.bindBuffer(34962,a.buffer.buffer),t.vertexAttribPointer(n,a.size,a.type,a.normalized,a.stride,a.offset),e&&a.divisor&&e.vertexAttribDivisorANGLE(n,a.divisor)):(t.disableVertexAttribArray(n),t.vertexAttrib4f(n,a.x,a.y,a.z,a.w))}for(var i=r.length;i<u;++i)t.disableVertexAttribArray(i);var f=o.getElements(this.elements);f?t.bindBuffer(Tt,f.buffer.buffer):t.bindBuffer(Tt,null)},b.prototype.refresh=function(){var e=p();e&&(e.bindVertexArrayOES(this.vao),this.bindAttrs(),m.currentVAO=null,e.bindVertexArrayOES(null))},b.prototype.destroy=function(){if(this.vao){var e=p();this===m.currentVAO&&(m.currentVAO=null,e.bindVertexArrayOES(null)),e.deleteVertexArrayOES(this.vao),this.vao=null}this.ownsElements&&(this.elements.destroy(),this.elements=null,this.ownsElements=!1),d[this.id]&&(delete d[this.id],a.vaoCount-=1)},m}(a,d,y,l,x,w,g),k=function(e,r,n,a){var i={},o={};function f(e,t,r,n){this.name=e,this.id=t,this.location=r,this.info=n}function u(e,t){for(var r=0;r<e.length;++r)if(e[r].id===t.id)return void(e[r].location=t.location);e.push(t)}function s(t,n,a){var f=35632===t?i:o,u=f[n];if(!u){var s=r.str(n);u=e.createShader(t),e.shaderSource(u,s),e.compileShader(u),S.shaderError(e,u,s,t,a),f[n]=u}return u}var c={},l=[],d=0;function m(e,t){this.id=d++,this.fragId=e,this.vertId=t,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,a.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function p(t,n,i){var o,c,l=s(35632,t.fragId),d=s(35633,t.vertId),m=t.program=e.createProgram();if(e.attachShader(m,l),e.attachShader(m,d),i)for(o=0;o<i.length;++o){var p=i[o];e.bindAttribLocation(m,p[0],p[1])}e.linkProgram(m),S.linkError(e,m,r.str(t.fragId),r.str(t.vertId),n);var h=e.getProgramParameter(m,35718);a.profile&&(t.stats.uniformsCount=h);var b=t.uniforms;for(o=0;o<h;++o)if(c=e.getActiveUniform(m,o)){if(c.size>1)for(var v=0;v<c.size;++v){var g=c.name.replace("[0]","["+v+"]");u(b,new f(g,r.id(g),e.getUniformLocation(m,g),c))}var y=c.name;c.size>1&&(y=y.replace("[0]","")),u(b,new f(y,r.id(y),e.getUniformLocation(m,y),c))}var x=e.getProgramParameter(m,35721);a.profile&&(t.stats.attributesCount=x);var w=t.attributes;for(o=0;o<x;++o)(c=e.getActiveAttrib(m,o))&&u(w,new f(c.name,r.id(c.name),e.getAttribLocation(m,c.name),c))}return a.profile&&(n.getMaxUniformsCount=function(){var e=0;return l.forEach(function(t){t.stats.uniformsCount>e&&(e=t.stats.uniformsCount)}),e},n.getMaxAttributesCount=function(){var e=0;return l.forEach(function(t){t.stats.attributesCount>e&&(e=t.stats.attributesCount)}),e}),{clear:function(){var t=e.deleteShader.bind(e);q(i).forEach(t),i={},q(o).forEach(t),o={},l.forEach(function(t){e.deleteProgram(t.program)}),l.length=0,c={},n.shaderCount=0},program:function(r,a,f,u){S.command(r>=0,"missing vertex shader",f),S.command(a>=0,"missing fragment shader",f);var s=c[a];s||(s=c[a]={});var d=s[r];if(d&&(d.refCount++,!u))return d;var h=new m(a,r);return n.shaderCount++,p(h,f,u),d||(s[r]=h),l.push(h),t(h,{destroy:function(){if(h.refCount--,h.refCount<=0){e.deleteProgram(h.program);var t=l.indexOf(h);l.splice(t,1),n.shaderCount--}s[h.vertId].refCount<=0&&(e.deleteShader(o[h.vertId]),delete o[h.vertId],delete c[h.fragId][h.vertId]),Object.keys(c[h.fragId]).length||(e.deleteShader(i[h.fragId]),delete i[h.fragId],delete c[h.fragId])}})},restore:function(){i={},o={};for(var e=0;e<l.length;++e)p(l[e],null,l[e].attributes.map(function(e){return[e.location,e.name]}))},shader:s,frag:-1,vert:-1}}(a,c,l,n),O=pt(a,d,y,function(){D.procs.poll()},v,l,n),E=function(e,t,r,n,a){var i={rgba4:bt,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};t.ext_srgb&&(i.srgba=35907),t.ext_color_buffer_half_float&&(i.rgba16f=34842,i.rgb16f=34843),t.webgl_c
48olor_buffer_float&&(i.rgba32f=34836);var o=[];Object.keys(i).forEach(function(e){var t=i[e];o[t]=e});var f=0,u={};function s(e){this.id=f++,this.refCount=1,this.renderbuffer=e,this.format=bt,this.width=0,this.height=0,a.profile&&(this.stats={size:0})}function c(t){var r=t.renderbuffer;S(r,"must not double destroy renderbuffer"),e.bindRenderbuffer(ht,null),e.deleteRenderbuffer(r),t.renderbuffer=null,t.refCount=0,delete u[t.id],n.renderbufferCount--}return s.prototype.decRef=function(){--this.refCount<=0&&c(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var e=0;return Object.keys(u).forEach(function(t){e+=u[t].stats.size}),e}),{create:function(t,f){var c=new s(e.createRenderbuffer());function l(t,n){var f=0,u=0,s=bt;if("object"==typeof t&&t){var d=t;if("shape"in d){var m=d.shape;S(Array.isArray(m)&&m.length>=2,"invalid renderbuffer shape"),f=0|m[0],u=0|m[1]}else"radius"in d&&(f=u=0|d.radius),"width"in d&&(f=0|d.width),"height"in d&&(u=0|d.height);"format"in d&&(S.parameter(d.format,i,"invalid renderbuffer format"),s=i[d.format])}else"number"==typeof t?(f=0|t,u="number"==typeof n?0|n:f):t?S.raise("invalid arguments to renderbuffer constructor"):f=u=1;if(S(f>0&&u>0&&f<=r.maxRenderbufferSize&&u<=r.maxRenderbufferSize,"invalid renderbuffer size"),f!==c.width||u!==c.height||s!==c.format)return l.width=c.width=f,l.height=c.height=u,c.format=s,e.bindRenderbuffer(ht,c.renderbuffer),e.renderbufferStorage(ht,s,f,u),S(0===e.getError(),"invalid render buffer format"),a.profile&&(c.stats.size=gt(c.format,c.width,c.height)),l.format=o[c.format],l}return u[c.id]=c,n.renderbufferCount++,l(t,f),l.resize=function(t,n){var i=0|t,o=0|n||i;return i===c.width&&o===c.height||(S(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),l.width=c.width=i,l.height=c.height=o,e.bindRenderbuffer(ht,c.renderbuffer),e.renderbufferStorage(ht,c.format,i,o),S(0===e.getError(),"invalid render buffer format"),a.profile&&(c.stats.size=gt(c.format,c.width,c.height))),l},l._reglType="renderbuffer",l._renderbuffer=c,a.profile&&(l.stats=c.stats),l.destroy=function(){c.decRef()},l},clear:function(){q(u).forEach(c)},restore:function(){q(u).forEach(function(t){t.renderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(ht,t.renderbuffer),e.renderbufferStorage(ht,t.format,t.width,t.height)}),e.bindRenderbuffer(ht,null)}}}(a,d,y,l,n),T=function(e,r,n,a,i,o){var f={cur:null,next:null,dirty:!1,setFBO:null},u=["rgba"],s=["rgba4","rgb565","rgb5 a1"];r.ext_srgb&&s.push("srgba"),r.ext_color_buffer_half_float&&s.push("rgba16f","rgb16f"),r.webgl_color_buffer_float&&s.push("rgba32f");var c=["uint8"];function l(e,t,r){this.target=e,this.texture=t,this.renderbuffer=r;var n=0,a=0;t?(n=t.width,a=t.height):r&&(n=r.width,a=r.height),this.width=n,this.height=a}function d(e){e&&(e.texture&&e.texture._texture.decRef(),e.renderbuffer&&e.renderbuffer._renderbuffer.decRef())}function m(e,t,r){if(e)if(e.texture){var n=e.texture._texture,a=Math.max(1,n.width),i=Math.max(1,n.height);S(a===t&&i===r,"inconsistent width/height for supplied texture"),n.refCount+=1}else{var o=e.renderbuffer._renderbuffer;S(o.width===t&&o.height===r,"inconsistent width/height for renderbuffer"),o.refCount+=1}}function p(t,r){r&&(r.texture?e.framebufferTexture2D(yt,t,r.target,r.texture._texture.texture,0):e.framebufferRenderbuffer(yt,t,xt,r.renderbuffer._renderbuffer.renderbuffer))}function h(e){var t=wt,r=null,n=null,a=e;"object"==typeof e&&(a=e.data,"target"in e&&(t=0|e.target)),S.type(a,"function","invalid attachment data");var i=a._reglType;return"texture2d"===i?(r=a,S(t===wt)):"textureCube"===i?(r=a,S(t>=At&&t<34075,"invalid cube map target")):"renderbuffer"===i?(n=a,t=xt):S.raise("invalid regl object for attachment"),new l(t,r,n)}function b(e,t,r,n,o){if(r){var f=a.create2D({width:e,height:t,format:n,type:o});return f._texture.refCount=0,new l(wt,f,null)}var u=i.create({width:e,height:t,format:n});return u._renderbuffer.refCount=0,new l(xt,null,u)}function v(e){return e&&(e.texture||e.renderbuffer)}function g(e,t,r){e&&(e.texture?e.texture.resize(t,r):e.renderbuffer&&e.renderbuffer.resize(t,r),e.width=t,e.height=r)}r.oes_texture_half_float&&c.push("half float","float16"),r.oes_texture_float&&c.push("float","float32");var y=0,x={};function w(){this.id=y++,x[this.id]=this,this.framebuffer=e.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}
48function A(e){e.colorAttachments.forEach(d),d(e.depthAttachment),d(e.stencilAttachment),d(e.depthStencilAttachment)}function k(t){var r=t.framebuffer;S(r,"must not double destroy framebuffer"),e.deleteFramebuffer(r),t.framebuffer=null,o.framebufferCount--,delete x[t.id]}function O(t){var r;e.bindFramebuffer(yt,t.framebuffer);var a=t.colorAttachments;for(r=0;r<a.length;++r)p(36064+r,a[r]);for(r=a.length;r<n.maxColorAttachments;++r)e.framebufferTexture2D(yt,36064+r,wt,null,0);e.framebufferTexture2D(yt,33306,wt,null,0),e.framebufferTexture2D(yt,36096,wt,null,0),e.framebufferTexture2D(yt,36128,wt,null,0),p(36096,t.depthAttachment),p(36128,t.stencilAttachment),p(33306,t.depthStencilAttachment);var i=e.checkFramebufferStatus(yt);e.isContextLost()||36053===i||S.raise("framebuffer configuration not supported, status = "+Et[i]),e.bindFramebuffer(yt,f.next?f.next.framebuffer:null),f.cur=f.next,e.getError()}function E(e,a){var i=new w;function l(e,t){var a;S(f.next!==i,"can not update framebuffer which is currently in use");var o=0,d=0,p=!0,g=!0,y=null,x=!0,w="rgba",k="uint8",E=1,T=null,D=null,j=null,C=!1;if("number"==typeof e)o=0|e,d=0|t||o;else if(e){S.type(e,"object","invalid arguments for framebuffer");var z=e;if("shape"in z){var F=z.shape;S(Array.isArray(F)&&F.length>=2,"invalid shape for framebuffer"),o=F[0],d=F[1]}else"radius"in z&&(o=d=z.radius),"width"in z&&(o=z.width),"height"in z&&(d=z.height);("color"in z||"colors"in z)&&(y=z.color||z.colors,Array.isArray(y)&&S(1===y.length||r.webgl_draw_buffers,"multiple render targets not supported")),y||("colorCount"in z&&(E=0|z.colorCount,S(E>0,"invalid color buffer count")),"colorTexture"in z&&(x=!!z.colorTexture,w="rgba4"),"colorType"in z&&(k=z.colorType,x?(S(r.oes_texture_float||!("float"===k||"float32"===k),"you must enable OES_texture_float in order to use floating point framebuffer objects"),S(r.oes_texture_half_float||!("half float"===k||"float16"===k),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===k||"float16"===k?(S(r.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),w="rgba16f"):"float"!==k&&"float32"!==k||(S(r.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),w="rgba32f"),S.oneOf(k,c,"invalid color type")),"colorFormat"in z&&(w=z.colorFormat,u.indexOf(w)>=0?x=!0:s.indexOf(w)>=0?x=!1:S.optional(function(){x?S.oneOf(z.colorFormat,u,"invalid color format for texture"):S.oneOf(z.colorFormat,s,"invalid color format for renderbuffer")}))),("depthTexture"in z||"depthStencilTexture"in z)&&(C=!(!z.depthTexture&&!z.depthStencilTexture),S(!C||r.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in z&&("boolean"==typeof z.depth?p=z.depth:(T=z.depth,g=!1)),"stencil"in z&&("boolean"==typeof z.stencil?g=z.stencil:(D=z.stencil,p=!1)),"depthStencil"in z&&("boolean"==typeof z.depthStencil?p=g=z.depthStencil:(j=z.depthStencil,p=!1,g=!1))}else o=d=1;var V=null,B=null,I=null,P=null;if(Array.isArray(y))V=y.map(h);else if(y)V=[h(y)];else for(V=new Array(E),a=0;a<E;++a)V[a]=b(o,d,x,w,k);S(r.webgl_draw_buffers||V.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),S(V.length<=n.maxColorAttachments,"too many color attachments, not supported"),o=o||V[0].width,d=d||V[0].height,T?B=h(T):p&&!g&&(B=b(o,d,C,"depth","uint32")),D?I=h(D):g&&!p&&(I=b(o,d,!1,"stencil","uint8")),j?P=h(j):!T&&!D&&g&&p&&(P=b(o,d,C,"depth stencil","depth stencil")),S(!!T+!!D+!!j<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var L=null;for(a=0;a<V.length;++a)if(m(V[a],o,d),S(!V[a]||V[a].texture&&_t.indexOf(V[a].texture._texture.format)>=0||V[a].renderbuffer&&Ot.indexOf(V[a].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+a+" is invalid"),V[a]&&V[a].texture){var R=kt[V[a].texture._texture.format]*St[V[a].texture._texture.type];null===L?L=R:S(L===R,"all color attachments much have the same number of bits per pixel.")}return m(B,o,d),S(!B||B.texture&&6402===B.texture._texture.format||B.renderbuffer&&33189===B.renderbuffer._renderbuffer.format,"invali
48d depth attachment for framebuffer object"),m(I,o,d),S(!I||I.renderbuffer&&36168===I.renderbuffer._renderbuffer.format,"invalid stencil attachment for framebuffer object"),m(P,o,d),S(!P||P.texture&&34041===P.texture._texture.format||P.renderbuffer&&34041===P.renderbuffer._renderbuffer.format,"invalid depth-stencil attachment for framebuffer object"),A(i),i.width=o,i.height=d,i.colorAttachments=V,i.depthAttachment=B,i.stencilAttachment=I,i.depthStencilAttachment=P,l.color=V.map(v),l.depth=v(B),l.stencil=v(I),l.depthStencil=v(P),l.width=i.width,l.height=i.height,O(i),l}return o.framebufferCount++,l(e,a),t(l,{resize:function(e,t){S(f.next!==i,"can not resize a framebuffer which is currently in use");var r=Math.max(0|e,1),n=Math.max(0|t||r,1);if(r===i.width&&n===i.height)return l;for(var a=i.colorAttachments,o=0;o<a.length;++o)g(a[o],r,n);return g(i.depthAttachment,r,n),g(i.stencilAttachment,r,n),g(i.depthStencilAttachment,r,n),i.width=l.width=r,i.height=l.height=n,O(i),l},_reglType:"framebuffer",_framebuffer:i,destroy:function(){k(i),A(i)},use:function(e){f.setFBO({framebuffer:l},e)}})}return t(f,{getFramebuffer:function(e){if("function"==typeof e&&"framebuffer"===e._reglType){var t=e._framebuffer;if(t instanceof w)return t}return null},create:E,createCube:function(e){var i=Array(6);function o(e){var n;S(i.indexOf(f.next)<0,"can not update framebuffer which is currently in use");var s,l={color:null},d=0,m=null,p="rgba",h="uint8",b=1;if("number"==typeof e)d=0|e;else if(e){S.type(e,"object","invalid arguments for framebuffer");var v=e;if("shape"in v){var g=v.shape;S(Array.isArray(g)&&g.length>=2,"invalid shape for framebuffer"),S(g[0]===g[1],"cube framebuffer must be square"),d=g[0]}else"radius"in v&&(d=0|v.radius),"width"in v?(d=0|v.width,"height"in v&&S(v.height===d,"must be square")):"height"in v&&(d=0|v.height);("color"in v||"colors"in v)&&(m=v.color||v.colors,Array.isArray(m)&&S(1===m.length||r.webgl_draw_buffers,"multiple render targets not supported")),m||("colorCount"in v&&(b=0|v.colorCount,S(b>0,"invalid color buffer count")),"colorType"in v&&(S.oneOf(v.colorType,c,"invalid color type"),h=v.colorType),"colorFormat"in v&&(p=v.colorFormat,S.oneOf(v.colorFormat,u,"invalid color format for texture"))),"depth"in v&&(l.depth=v.depth),"stencil"in v&&(l.stencil=v.stencil),"depthStencil"in v&&(l.depthStencil=v.depthStencil)}else d=1;if(m)if(Array.isArray(m))for(s=[],n=0;n<m.length;++n)s[n]=m[n];else s=[m];else{s=Array(b);var y={radius:d,format:p,type:h};for(n=0;n<b;++n)s[n]=a.createCube(y)}for(l.color=Array(s.length),n=0;n<s.length;++n){var x=s[n];S("function"==typeof x&&"textureCube"===x._reglType,"invalid cube map"),d=d||x.width,S(x.width===d&&x.height===d,"invalid cube map shape"),l.color[n]={target:At,data:s[n]}}for(n=0;n<6;++n){for(var w=0;w<s.length;++w)l.color[w].target=At+n;n>0&&(l.depth=i[0].depth,l.stencil=i[0].stencil,l.depthStencil=i[0].depthStencil),i[n]?i[n](l):i[n]=E(l)}return t(o,{width:d,height:d,color:s})}return o(e),t(o,{faces:i,resize:function(e){var t,r=0|e;if(S(r>0&&r<=n.maxCubeMapSize,"invalid radius for cube fbo"),r===o.width)return o;var a=o.color;for(t=0;t<a.length;++t)a[t].resize(r);for(t=0;t<6;++t)i[t].resize(r);return o.width=o.height=r,o},_reglType:"framebufferCube",destroy:function(){i.forEach(function(e){e.destroy()})}})},clear:function(){q(x).forEach(k)},restore:function(){f.cur=null,f.next=null,f.dirty=!0,q(x).forEach(function(t){t.framebuffer=e.createFramebuffer(),O(t)})}})}(a,d,y,O,E,l),D=mn(a,c,d,y,x,w,0,T,{},A,k,g,v,m,n),j=Ft(a,T,D.procs.poll,v,i,d,y),V=D.next,B=a.canvas,P=[],L=[],R=[],Q=[n.onDestroy],Y=null;function X(){if(0===P.length)return m&&m.update(),void(Y=null);Y=z.next(X),xe();for(var e=P.length-1;e>=0;--e){var t=P[e];t&&t(v,null,0)}a.flush(),m&&m.update()}function $(){!Y&&P.length>0&&(Y=z.next(X))}function de(){Y&&(z.cancel(X),Y=null)}function me(e){e.preventDefault(),o=!0,de(),L.forEach(function(e){e()})}function pe(e){a.getError(),o=!1,f.restore(),k.restore(),x.restore(),O.restore(),E.restore(),T.restore(),A.restore(),m&&m.restore(),D.procs.refresh(),$(),R.forEach(function(e){e()})}function he(e){function r(e,t){var r={},n={};return Object.keys(e).forEach(function(a){var i=e[a];if(C.isDynamic(i))n[a]=C.unbox(i,a);else{if(t&&Array.isArray(i))for(var o=0;o<i.length;++o)if(C.isDynamic(i[o]))return void(n[a]=C.unbox(i,a));r[a]=i}}),{dynamic:n,static:r}}
48S(!!e,"invalid args to regl({...})"),S.type(e,"object","invalid args to regl({...})");var n=r(e.context||{},!0),a=r(e.uniforms||{},!0),i=r(e.attributes||{},!1),f=r(function(e){var r=t({},e);function n(e){if(e in r){var t=r[e];delete r[e],Object.keys(t).forEach(function(n){r[e+"."+n]=t[n]})}}return delete r.uniforms,delete r.attributes,delete r.context,delete r.vao,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),n("blend"),n("depth"),n("cull"),n("stencil"),n("polygonOffset"),n("scissor"),n("sample"),"vao"in e&&(r.vao=e.vao),r}(e),!1),u={gpuTime:0,cpuTime:0,count:0},s=D.compile(f,i,a,n,u),c=s.draw,l=s.batch,d=s.scope,m=[];return t(function(e,t){var r;if(o&&S.raise("context lost"),"function"==typeof e)return d.call(this,null,e,0);if("function"==typeof t)if("number"==typeof e)for(r=0;r<e;++r)d.call(this,null,t,r);else{if(!Array.isArray(e))return d.call(this,e,t,0);for(r=0;r<e.length;++r)d.call(this,e[r],t,r)}else if("number"==typeof e){if(e>0)return l.call(this,function(e){for(;m.length<e;)m.push(null);return m}(0|e),0|e)}else{if(!Array.isArray(e))return c.call(this,e);if(e.length)return l.call(this,e,e.length)}},{stats:u,destroy:function(){s.destroy()}})}B&&(B.addEventListener(hn,me,!1),B.addEventListener(bn,pe,!1));var be=T.setFBO=he({framebuffer:C.define.call(null,1,"framebuffer")});function ve(e,t){var r=0;D.procs.poll();var n=t.color;n&&(a.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=16384),"depth"in t&&(a.clearDepth(+t.depth),r|=256),"stencil"in t&&(a.clearStencil(0|t.stencil),r|=1024),S(!!r,"called regl.clear with no buffer specified"),a.clear(r)}function ge(e){return S.type(e,"function","regl.frame() callback must be a function"),P.push(e),$(),{cancel:function(){var t=vn(P,e);S(t>=0,"cannot cancel a frame twice"),P[t]=function e(){var t=vn(P,e);P[t]=P[P.length-1],P.length-=1,P.length<=0&&de()}}}}function ye(){var e=V.viewport,t=V.scissor_box;e[0]=e[1]=t[0]=t[1]=0,v.viewportWidth=v.framebufferWidth=v.drawingBufferWidth=e[2]=t[2]=a.drawingBufferWidth,v.viewportHeight=v.framebufferHeight=v.drawingBufferHeight=e[3]=t[3]=a.drawingBufferHeight}function xe(){v.tick+=1,v.time=Ae(),ye(),D.procs.poll()}function we(){O.refresh(),ye(),D.procs.refresh(),m&&m.update()}function Ae(){return(F()-p)/1e3}we();var _e=t(he,{clear:function(e){if(S("object"==typeof e&&e,"regl.clear() takes an object as input"),"framebuffer"in e)if(e.framebuffer&&"framebufferCube"===e.framebuffer_reglType)for(var r=0;r<6;++r)be(t({framebuffer:e.framebuffer.faces[r]},e),ve);else be(e,ve);else ve(0,e)},prop:C.define.bind(null,1),context:C.define.bind(null,2),this:C.define.bind(null,3),draw:he({}),buffer:function(e){return x.create(e,34962,!1,!1)},elements:function(e){return w.create(e,!1)},texture:O.create2D,cube:O.createCube,renderbuffer:E.create,framebuffer:T.create,framebufferCube:T.createCube,vao:A.createVAO,attributes:i,frame:ge,on:function(e,t){var r;switch(S.type(t,"function","listener callback must be a function"),e){case"frame":return ge(t);case"lost":r=L;break;case"restore":r=R;break;case"destroy":r=Q;break;default:S.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(t),{cancel:function(){for(var e=0;e<r.length;++e)if(r[e]===t)return r[e]=r[r.length-1],void r.pop()}}},limits:y,hasExtension:function(e){return y.extensions.indexOf(e.toLowerCase())>=0},read:j,destroy:function(){P.length=0,de(),B&&(B.removeEventListener(hn,me),B.removeEventListener(bn,pe)),k.clear(),T.clear(),E.clear(),A.clear(),O.clear(),w.clear(),x.clear(),m&&m.clear(),Q.forEach(function(e){e()})},_gl:a,_refresh:we,poll:function(){xe(),m&&m.update()},now:Ae,stats:l});return n.onDone(null,_e),_e}},"object"==typeof r&&void 0!==t?t.exports=o():"function"==typeof define&&define.amd?define(o):i.createREGL=o()}, 49643: function _(t,e,n,r,a){r(),n.normalize_dash_pattern=function(t){for(const e of t)if(!Number.isInteger(e)||e<0)return o.logger.warn(`invalid line dash pattern: ${t.join(",")}`),[];t.length%2==1&&(t=(0,c.concat)([t,t]));return 0==(0,i.sum)(t)?[]:t};const s=t(644),o=t(11),c=t(10),i=t(14);n.DashCache=class DashCache{_regl;_map;constructor(t){this._regl=t,this._map=new Map}_create_texture(t){const e=t.length;let n=0;const r=[];let a=0,o=0;for(let s=0;s<e;s++)n+=t[s],r.push(t[s]+t[(s+1)%e]),s%2==0?o=Math.max(o,t[s]):a=Math.min(a,-t[s]);a*=.5,o*=.5;const c=(0,s.gcd)(r),i=[0];for(let n=0;n<e;n++)i.push(i[n]+t[n]);const h=2*n/c,l=(0,s.is_pow_2)(h),g=l?h:128,u=.5*c*h/g;let p;if(l){if(p=.5*t[0],u<p){p-=Math.floor(p/u)*u}}
49else p=0;const f=p-.5*u,m=new Uint8Array(g);let d=0;for(let e=0;e<g;e++){const n=p+e*u;n>i[d+1]&&d++;const r=t[d],s=i[d]+.5*r;let c=.5*r-Math.abs(n-s);d%2==1&&(c=-c),m[e]=Math.round(255*(c-a)/(o-a))}return[[n,f,a,o],this._regl.texture({shape:[g,1,1],data:m,wrapS:"repeat",format:"alpha",type:"uint8",mag:"linear",min:"linear"})]}_get_key(t){return t.join(",")}_get_or_create(t){const e=this._get_key(t);let n=this._map.get(e);if(null==n){const r=(0,s.gcd)(t);if(r>1){t=(0,i.map)(t,t=>t/r),n=this._get_or_create(t);const[a,s,o]=n;n=[a,s,r],this._map.set(e,n)}else{const[a,s]=this._create_texture(t);n=[a,s,r],this._map.set(e,n)}}return n}get(t){return t.length%2==1&&(t=(0,c.concat)([t,t])),this._get_or_create(t)}}}, 50644: function _(n,t,e,r,o){function u(n,t){let e,r;n>t?(e=n,r=t):(e=t,r=n);let o=e%r;for(;0!=o;)e=r,r=o,o=e%r;return r}r(),e.gcd=function(n){let t=n[0];for(let e=1;e<n.length;e++)t=u(t,n[e]);return t},e.is_pow_2=function(n){return!(n&n-1)&&0!=n}}, 51645: function _(i,o,t,n,a){n();t.default="\nprecision mediump float;attribute vec2 a_position;varying vec2 v_tex_coords;void main(){gl_Position=vec4(a_position.x,a_position.y,0.,1.);v_tex_coords=0.5*(1.+a_position);}"}, 52646: function _(e,r,o,f,t){f();o.default="\nprecision mediump float;uniform sampler2D u_framebuffer_tex;varying vec2 v_tex_coords;void main(){gl_FragColor=texture2D(u_framebuffer_tex,v_tex_coords);}"}, 53647: function _(o,i,a,s,n){s();a.default="\nprecision mediump float;attribute vec2 a_position;attribute vec4 a_bounds;uniform vec2 u_canvas_size;varying vec2 v_tex_coords;void main(){v_tex_coords=vec2(a_position.x<0.?0.:1.,a_position.y<0.?0.:1.);float x=a_position.x<0.?a_bounds[0]:a_bounds[2];float y=a_position.y<0.?a_bounds[1]:a_bounds[3];vec2 xy=vec2(x,y);vec2 pos=xy+0.5;pos/=u_canvas_size;gl_Position=vec4(2.*pos.x-1.,1.-2.*pos.y,0.,1.);}"}, 54648: function _(o,a,l,r,e){r();l.default="\nprecision mediump float;uniform sampler2D u_tex;uniform float u_global_alpha;varying vec2 v_tex_coords;void main(){vec4 color=texture2D(u_tex,v_tex_coords);float alpha=color.a*u_global_alpha;gl_FragColor=vec4(color.rgb*alpha,alpha);}"}, 55649: function _(t,n,e,a,i){a();e.default="\nprecision mediump float;const int butt_cap=0;const int round_cap=1;const int square_cap=2;const int miter_join=0;const int round_join=1;const int bevel_join=2;attribute vec2 a_position;attribute vec2 a_point_prev;attribute vec2 a_point_start;attribute vec2 a_point_end;attribute vec2 a_point_next;attribute float a_show_prev;attribute float a_show_curr;attribute float a_show_next;attribute float a_linewidth;attribute vec4 a_line_color;attribute float a_line_cap;attribute float a_line_join;\n#ifdef DASHED\nattribute float a_length_so_far;attribute vec4 a_dash_tex_info;attribute float a_dash_scale;attribute float a_dash_offset;\n#endif\nuniform vec2 u_canvas_size;uniform float u_antialias;uniform float u_miter_limit;varying float v_linewidth;varying vec4 v_line_color;varying float v_line_cap;varying float v_line_join;varying float v_segment_length;varying vec2 v_coords;varying float v_flags;varying float v_cos_turn_angle_start;varying float v_cos_turn_angle_end;\n#ifdef DASHED\nvarying float v_length_so_far;varying vec4 v_dash_tex_info;varying float v_dash_scale;varying float v_dash_offset;\n#endif\n#define SMALL 1e-6\nfloat cross_z(in vec2 v0,in vec2 v1){return v0.x*v1.y-v0.y*v1.x;}vec2 right_vector(in vec2 v){return vec2(v.y,-v.x);}float calc_turn_angle(in bool has_cap,in vec2 segment_right,in vec2 other_right,out vec2 point_right,out float sin_turn_angle){float cos_turn_angle;vec2 diff=segment_right+other_right;float len=length(diff);if(has_cap||len<SMALL){point_right=segment_right;cos_turn_angle=-1.;sin_turn_angle=0.;}else{point_right=diff/len;cos_turn_angle=dot(segment_right,other_right);sin_turn_angle=cross_z(segment_right,other_right);}return cos_turn_angle;}bool miter_too_large(in int join_type,in float cos_turn_angle){float cos_half_angle_sqr=0.5*(1.+cos_turn_angle);return join_type==miter_join&&cos_half_angle_sqr<1./(u_miter_limit*u_miter_limit);}vec2 normalize_check_len(in vec2 vec,in float len){if(abs(len)<SMALL)return vec2(1.,0.);else return vec/len;}vec2 normalize_check(in vec2 vec){return normalize_check_len(vec,length(vec));}void main(){if(a_show_curr<0.5){gl_Position=vec4(-2.,-2.,0.,1.);return;}int join_type=int(a_line_join+0.5);int cap_type=int(a_line_cap+0.5);v_linewidth=a_linewidth;v_line_color=a_line_color;if(v_linewidth<1.){v_line_color.a*=v_linewidth;v_linewidth=1.;}float halfwidth=0.5*(v_linewidth+u_antialias);vec2 segment_along=a_point_end-a_point_start;v_segment_length=length(a_point_end-a_point_start);segment_along=normalize_check_len(segment_along,v_segment_length);vec2 segment_right=right_vector(segment_along);vec2 xy;vec2 prev_along=normalize_check(a_point_start-a_point_prev);vec2 prev_right=right_vector(prev_along);vec2 next_right=right_vector(normalize_check(a_point_next-a_point_end));v_coords.y=a_position.y*halfwidth;bool has_start_cap=a_show_prev<0.5;bool has_end_cap=a_show_next<0.5;vec2 point_right_start,point_right_end;float sin_turn_angle_start,sin_turn_angle_end;v_cos_turn_angle_start=calc_turn_angle(has_start_cap,segment_right,prev_right,point_right_start,sin_turn_angle_start);v_cos_turn_angle_end=calc_turn_angle(has_end_cap,segment_right,next_right,point_right_end,sin_turn_angle_end);float sign_turn_right_start=sin_turn_angle_start>=0.?1.:-1.;bool miter_too_large_start=!has_start_cap&&miter_too_large(join_type,v_cos_turn_angle_start);bool miter_too_large_end=!has_end_cap&&miter_too_large(join_type,v_cos_turn_angle_end);float sign_at_start=-sign(a_position.x);vec2 point=sign_at_start>0.?a_point_start:a_point_end;if((has_start_cap&&sign_at_start>0.)||(has_end_cap&&sign_at_start<0.)){xy=point-segment_right*(halfwidth*a_position.y);if(cap_type==butt_cap)xy-=sign_at_start*0.5*u_antialias*segment_along;else xy-=sign_at_start*halfwidth*segment_along;}else if(sign_at_start>0.){vec2 inside_point=a_point_start+segment_right*(sign_turn_right_start*halfwidth);vec2 prev_outside_point=a_point_start-prev_right*(sign_turn_right_start*halfwidth);if(join_type==round_join||join_type==bevel_join||miter_too_large_start){if(v_cos_turn_angle_start<=0.){xy=a_point_start-segment_right*(halfwidth*a_position.y)-halfwidth*segment_along;}else{if(a_position.x<-1.5){xy=prev_outside_point;v_coords.y=-dot(xy-a_point_start,segment_right);}else if(a_position.y*sign_turn_right_start>0.){float d=halfwidth*abs(sin_turn_angle_start);xy=a_point_start-segment_right*(halfwidth*a_position.y)-d*segment_along;}else{xy=inside_point;}}}else{if(a_position.x<-1.5){xy=prev_outside_point;v_coords.y=-dot(xy-a_point_start,segment_right);}else if(a_position.y*sign_turn_right_start>0.){float tan_half_turn_angle=(1.-v_cos_turn_angle_start)/sin_turn_angle_start;float d=sign_turn_right_start*halfwidth*tan_half_turn_angle;xy=a_point_start-segment_right*(halfwidth*a_position.y)-d*segment_along;}else{xy=inside_point;}}}else{xy=point-segment_right*(halfwidth*a_position.y);}vec2 pos=xy+0.5;pos/=u_canvas_size;gl_Position=vec4(2.*pos.x-1.,1.-2.*pos.y,0.,1.);bool turn_right_start=sin_turn_angle_start>=0.;bool turn_right_end=sin_turn_angle_end>=0.;v_coords.x=dot(xy-a_point_start,segment_along);v_flags=float(int(has_start_cap)+2*int(has_end_cap)+4*int(miter_too_large_start)+8*int(miter_too_large_end)+16*int(turn_right_start)+32*int(turn_right_end));v_line_cap=a_line_cap;v_line_join=a_line_join;\n#ifdef DASHED\nv_length_so_far=a_length_so_far;v_dash_tex_info=a_dash_tex_info;v_dash_scale=a_dash_scale;v_dash_offset=a_dash_offset;\n#endif\n}"}, 56650: function _(t,a,i,n,s){n();i.default="\nprecision mediump float;const int butt_cap=0;const int round_cap=1;const int square_cap=2;const int miter_join=0;const int round_join=1;const int bevel_join=2;uniform float u_antialias;\n#ifdef DASHED\nuniform sampler2D u_dash_tex;\n#endif\nvarying float v_linewidth;varying vec4 v_line_color;varying float v_line_cap;varying float v_line_join;varying float v_segment_length;varying vec2 v_coords;varying float v_flags;varying float v_cos_turn_angle_start;varying float v_cos_turn_angle_end;\n#ifdef DASHED\nvarying float v_length_so_far;varying vec4 v_dash_tex_info;varying float v_dash_scale;varying float v_dash_offset;\n#endif\n#define ONE_MINUS_SMALL (1.0 - 1e-6)\nfloat cross_z(in vec2 v0,in vec2 v1){return v0.x*v1.y-v0.y*v1.x;}vec2 right_vector(in vec2 v){return vec2(v.y,-v.x);}float bevel_join_distance(in vec2 coords,in vec2 other_right,in float sign_turn_right){float hw=0.5*v_linewidth;if(other_right.y>=ONE_MINUS_SMALL){return abs(hw-v_coords.x);}else{const vec2 segment_right=vec2(0.,-1.);vec2 corner_right=normalize(other_right+segment_right);vec2 outside_point=(-hw*sign_turn_right)*segment_right;return hw+sign_turn_right*dot(outside_point-coords,corner_right);}}
56float cap(in int cap_type,in float x,in float y){if(cap_type==butt_cap)return max(0.5*v_linewidth-x,abs(y));else if(cap_type==square_cap)return max(-x,abs(y));else return distance(vec2(min(x,0.),y),vec2(0.,0.));}float distance_to_alpha(in float dist){return 1.-smoothstep(0.5*(v_linewidth-u_antialias),0.5*(v_linewidth+u_antialias),dist);}vec2 turn_angle_to_right_vector(in float cos_turn_angle,in float sign_turn_right){float sin_turn_angle=sign_turn_right*sqrt(1.-cos_turn_angle*cos_turn_angle);return vec2(sin_turn_angle,-cos_turn_angle);}\n#ifdef DASHED\nfloat dash_distance(in float x){float tex_length=v_dash_tex_info.x;float tex_offset=v_dash_tex_info.y;float tex_dist_min=v_dash_tex_info.z;float tex_dist_max=v_dash_tex_info.w;x+=v_length_so_far-v_dash_scale*tex_offset+v_dash_offset;float dist=texture2D(u_dash_tex,vec2(x/(tex_length*v_dash_scale),0.)).a;dist=tex_dist_min+dist*(tex_dist_max-tex_dist_min);return v_dash_scale*dist;}mat2 rotation_matrix(in vec2 other_right){float sin_angle=other_right.x;float cos_angle=-other_right.y;return mat2(cos_angle,-sin_angle,sin_angle,cos_angle);}\n#endif\nvoid main(){int join_type=int(v_line_join+0.5);int cap_type=int(v_line_cap+0.5);float halfwidth=0.5*(v_linewidth+u_antialias);float half_antialias=0.5*u_antialias;int flags=int(v_flags+0.5);bool turn_right_end=(flags/32>0);float sign_turn_right_end=turn_right_end?1.:-1.;flags-=32*int(turn_right_end);bool turn_right_start=(flags/16>0);float sign_turn_right_start=turn_right_start?1.:-1.;flags-=16*int(turn_right_start);bool miter_too_large_end=(flags/8>0);flags-=8*int(miter_too_large_end);bool miter_too_large_start=(flags/4>0);flags-=4*int(miter_too_large_start);bool has_end_cap=(flags/2>0);flags-=2*int(has_end_cap);bool has_start_cap=flags>0;vec2 prev_right=turn_angle_to_right_vector(v_cos_turn_angle_start,sign_turn_right_start);vec2 next_right=turn_angle_to_right_vector(v_cos_turn_angle_end,sign_turn_right_end);float dist=v_coords.y;vec2 end_coords=vec2(v_segment_length,0.)-v_coords;if(v_coords.x<=half_antialias){if(has_start_cap)dist=cap(cap_type,v_coords.x,v_coords.y);else if(join_type==round_join){if(v_coords.x<=0.)dist=distance(v_coords,vec2(0.,0.));}else{if(join_type==bevel_join||miter_too_large_start)dist=max(abs(dist),bevel_join_distance(v_coords,prev_right,sign_turn_right_start));float prev_sideways_dist=-sign_turn_right_start*dot(v_coords,prev_right);dist=max(abs(dist),prev_sideways_dist);}}if(end_coords.x<=half_antialias){if(has_end_cap){dist=max(abs(dist),cap(cap_type,end_coords.x,v_coords.y));}else if(join_type==bevel_join||miter_too_large_end){dist=max(abs(dist),bevel_join_distance(end_coords,next_right,sign_turn_right_end));}}float alpha=distance_to_alpha(abs(dist));\n#ifdef DASHED\nif(v_dash_tex_info.x>=0.){dist=dash_distance(v_coords.x);vec2 prev_coords=rotation_matrix(prev_right)*v_coords;float start_dash_distance=dash_distance(0.);if(!has_start_cap&&cap_type==butt_cap){bool outer_solid=start_dash_distance>=0.&&v_coords.x<half_antialias&&prev_coords.x>-half_antialias;if(outer_solid){float half_aa_dist=dash_distance(half_antialias);if(half_aa_dist>0.)dist=half_aa_dist-v_coords.x+half_antialias;else dist=start_dash_distance-v_coords.x;half_aa_dist=dash_distance(-half_antialias);if(half_aa_dist>0.)dist=min(dist,half_aa_dist+prev_coords.x+half_antialias);else dist=min(dist,start_dash_distance+prev_coords.x);}else{if(v_coords.x<half_antialias)dist=min(0.,dash_distance(half_antialias)-half_antialias)+v_coords.x;if(prev_coords.x>-half_antialias&&prev_coords.x<=half_antialias){float prev_dist=min(0.,dash_distance(-half_antialias)-half_antialias)-prev_coords.x;prev_dist=min(prev_dist,0.5*v_linewidth-abs(prev_coords.y));dist=max(dist,prev_dist);}}}if(!has_end_cap&&cap_type==butt_cap&&end_coords.x<half_antialias){float end_dash_distance=dash_distance(v_segment_length);bool increasing=end_dash_distance>=0.&&sign_turn_right_end*v_coords.y<0.;if(!increasing){float half_aa_dist=dash_distance(v_segment_length-half_antialias);dist=min(0.,half_aa_dist-half_antialias)+end_coords.x;}}dist=cap(cap_type,dist,v_coords.y);float dash_alpha=distance_to_alpha(dist);alpha=min(alpha,dash_alpha);}\n#endif\nalpha=v_line_color.a*alpha;gl_FragColor=vec4(v_line_color.rgb*alpha,alpha);}"}, 57651: function _(i,e,n,a,t){a();n.default="\nprecision mediump float;attribute vec2 a_position;attribute vec2 a_center;attribute float a_width;attribute float a_height;attribute float a_angle;attribute float a_aux;attribute float a_linewidth;attribute vec4 a_line_color;attribute vec4 a_fill_color;attribute float a_line_cap;attribute float a_line_join;attribute float a_show;\n#ifdef HATCH\nattribute float a_hatch_pattern;attribute float a_hatch_scale;attribute float a_hatch_weight;attribute vec4 a_hatch_color;\n#endif\nuniform vec2 u_canvas_size;uniform float u_antialias;\n#ifdef MULTI_MARKER\nuniform float u_size_hint;\n#endif\n#ifdef USE_ROUND_RECT\nuniform vec4 u_border_radius;varying vec4 v_border_radius;\n#endif\n#ifdef USE_ANNULAR_WEDGE\nvarying float v_outer_radius;varying float v_inner_radius;varying float v_start_angle;varying float v_end_angle;\n#endif\n#ifdef USE_ANNULUS\nvarying float v_outer_radius;varying float v_inner_radius;\n#endif\n#ifdef USE_WEDGE\nvarying float v_radius;varying float v_start_angle;varying float v_end_angle;\n#endif\n#if defined(USE_CIRCLE) || defined(USE_NGON)\nvarying float v_radius;\n#endif\n#ifdef USE_NGON\nvarying float v_n;\n#endif\nvarying float v_linewidth;varying vec2 v_size;varying vec4 v_line_color;varying vec4 v_fill_color;varying float v_line_cap;varying float v_line_join;varying vec2 v_coords;\n#ifdef HATCH\nvarying float v_hatch_pattern;varying float v_hatch_scale;varying float v_hatch_weight;varying vec4 v_hatch_color;varying vec2 v_hatch_coords;\n#endif\n#ifdef MULTI_MARKER\n#define M_DASH 1\n#define M_DOT 2\n#define M_DIAMOND 3\n#define M_HEX 4\n#define M_SQUARE_PIN 5\n#define M_TRIANGLE 6\n#define M_TRIANGLE_PIN 7\n#define M_STAR 8\nvec2 enclosing_size(){int size_hint=int(u_size_hint+0.5);if(size_hint==M_DASH)return vec2(v_size.x+v_linewidth+u_antialias,v_linewidth+u_antialias);else if(size_hint==M_DOT)return 0.25*v_size+u_antialias;else if(size_hint==M_DIAMOND)return vec2(v_size.x*(2./3.)+(v_linewidth+u_antialias)*1.20185,v_size.y+(v_linewidth+u_antialias)*1.80278);else if(size_hint==M_HEX)return v_size+(v_linewidth+u_antialias)*vec2(2./sqrt(3.),1.);else if(size_hint==M_SQUARE_PIN)return v_size+(v_linewidth+u_antialias)*3.1;else if(size_hint==M_TRIANGLE)return vec2(v_size.x+(v_linewidth+u_antialias)*sqrt(3.),v_size.y*(2./sqrt(3.))+(v_linewidth+u_antialias)*2.);else if(size_hint==M_TRIANGLE_PIN)return v_size+(v_linewidth+u_antialias)*vec2(4.8,6.);else if(size_hint==M_STAR)return vec2(v_size.x*0.95106+(v_linewidth+u_antialias)*3.,v_size.y+(v_linewidth+u_antialias)*3.2);else return v_size+v_linewidth+u_antialias;}\n#else\nvec2 enclosing_size(){return v_size+v_linewidth+u_antialias;}\n#endif\nvoid main(){\n#if defined(USE_RECT) || defined(USE_ROUND_RECT) || defined(USE_HEX_TILE)\nv_size=vec2(a_width,a_height);\n#elif defined(USE_ANNULUS) || defined(USE_ANNULAR_WEDGE) || defined(USE_WEDGE)\nv_size=vec2(2.*a_width,2.*a_width);\n#else\nv_size=vec2(a_width,a_width);\n#endif\n#ifdef USE_NGON\nv_n=a_aux;\n#endif\nif(a_show<0.5||v_size.x<0.||v_size.y<0.||(v_size.x==0.&&v_size.y==0.)\n#ifdef USE_NGON\n||v_n<3.\n#endif\n){gl_Position=vec4(-2.,-2.,0.,1.);return;}\n#ifdef USE_ANNULAR_WEDGE\nv_outer_radius=a_width;v_inner_radius=a_height;v_start_angle=a_angle;v_end_angle=a_aux;\n#endif\n#ifdef USE_ANNULUS\nv_outer_radius=a_width;v_inner_radius=a_height;\n#endif\n#ifdef USE_WEDGE\nv_radius=a_width;v_start_angle=a_angle;v_end_angle=a_aux;\n#endif\n#if defined(USE_CIRCLE) || defined(USE_NGON)\nv_radius=0.5*a_width;\n#endif\n#ifdef USE_ROUND_RECT\nconst vec2 unit2=vec2(1.,1.);float scale=min(v_size.x/max(dot(u_border_radius.xy,unit2),dot(u_border_radius.zw,unit2)),v_size.y/max(dot(u_border_radius.yz,unit2),dot(u_border_radius.wx,unit2)));v_border_radius=u_border_radius*min(scale,1.);\n#endif\nv_linewidth=a_linewidth;v_line_color=a_line_color;v_fill_color=a_fill_color;v_line_cap=a_line_cap;v_line_join=a_line_join;if(v_linewidth<1.){v_line_color.a*=v_linewidth;v_linewidth=1.;}\n#ifdef HATCH\nv_hatch_pattern=a_hatch_pattern;v_hatch_scale=a_hatch_scale;v_hatch_weight=a_hatch_weight;v_hatch_color=a_hatch_color;\n#endif\nv_coords=a_position*enclosing_size();\n#if defined(USE_CIRCLE) || defined(USE_ANNULUS) || defined(USE_ANNULAR_WEDGE) || defined(USE_WEDGE)\nvec2 pos=a_center+v_coords;\n#else\nfloat c=cos(-a_angle);float s=sin(-a_angle);mat2 rotation=mat2(c,-s,s,c);vec2 pos=a_center+rotation*v_coords;\n#endif\n#ifdef HATCH\nv_hatch_coords=pos-0.5;\n#endif\npos+=0.5;pos/=u_canvas_size;gl_Position=vec4(2.*pos.x-1.,1.-2.*pos.y,0.,1.);}"}, 58652: function _(n,i,e,t,a){t();e.default="\nprecision mediump float;const float SQRT2=sqrt(2.);const float SQRT3=sqrt(3.);const float PI=3.14159265358979323846;const int butt_cap=0;const int round_cap=1;const int square_cap=2;const int miter_join=0;const int round_join=1;const int bevel_join=2;\n#ifdef HATCH\nconst int hatch_dot=1;const int hatch_ring=2;const int hatch_horizontal_line=3;const int hatch_vertical_line=4;const int hatch_cross=5;const int hatch_horizontal_dash=6;const int hatch_vertical_dash=7;const int hatch_spiral=8;const int hatch_right_diagonal_line=9;const int hatch_left_diagonal_line=10;const int hatch_diagonal_cross=11;const int hatch_right_diagonal_dash=12;const int hatch_left_diagonal_dash=13;const int hatch_horizontal_wave=14;const int hatch_vertical_wave=15;const int hatch_criss_cross=16;\n#endif\nuniform float u_antialias;varying vec2 v_coords;varying vec2 v_size;\n#ifdef USE_ANNULAR_WEDGE\nvarying float v_outer_radius;varying float v_inner_radius;varying float v_start_angle;varying float v_end_angle;\n#endif\n#ifdef USE_ANNULUS\nvarying float v_outer_radius;varying float v_inner_radius;\n#endif\n#ifdef USE_WEDGE\nvarying float v_radius;varying float v_start_angle;varying float v_end_angle;\n#endif\n#if defined(USE_CIRCLE) || defined(USE_NGON)\nvarying float v_radius;\n#endif\n#ifdef USE_NGON\nvarying float v_n;\n#endif\n#ifdef USE_ROUND_RECT\nvarying vec4 v_border_radius;\n#endif\nvarying float v_linewidth;varying vec4 v_line_color;varying vec4 v_fill_color;varying float v_line_cap;varying float v_line_join;\n#ifdef HATCH\nvarying float v_hatch_pattern;varying float v_hatch_scale;varying float v_hatch_weight;varying vec4 v_hatch_color;varying vec2 v_hatch_coords;\n#endif\n#if defined(USE_CIRCLE_DOT) || defined(USE_DIAMOND_DOT) || defined(USE_DOT) || defined(USE_HEX_DOT) || defined(USE_SQUARE_DOT) || defined(USE_STAR_DOT) || defined(USE_TRIANGLE_DOT)\n#define APPEND_DOT \n#endif\n#if defined(USE_CIRCLE_CROSS) || defined(USE_SQUARE_CROSS)\n#define APPEND_CROSS \n#endif\n#ifdef USE_DIAMOND_CROSS\n#define APPEND_CROSS_2 \n#endif\n#ifdef USE_CIRCLE_X\n#define APPEND_X \n#define APPEND_X_LEN (0.5*v_size.x)\n#endif\n#ifdef USE_SQUARE_X\n#define APPEND_X \n#define APPEND_X_LEN (v_size.x/SQRT2)\n#endif\n#ifdef USE_CIRCLE_Y\
58n#define APPEND_Y \n#endif\n#if defined(USE_ASTERISK) || defined(USE_CROSS) || defined(USE_DASH) || defined(USE_DOT) || defined(USE_X) || defined(USE_Y)\n#define LINE_ONLY \n#endif\n#if defined(LINE_ONLY) || defined(APPEND_CROSS) || defined(APPEND_CROSS_2) || defined(APPEND_X) || defined(APPEND_Y)\nfloat end_cap_distance(in vec2 p,in vec2 end_point,in vec2 unit_direction,in int line_cap){vec2 offset=p-end_point;if(line_cap==butt_cap)return dot(offset,unit_direction)+0.5*v_linewidth;else if(line_cap==square_cap)return dot(offset,unit_direction);else if(line_cap==round_cap&&dot(offset,unit_direction)>0.)return length(offset);else return-v_linewidth-u_antialias;}\n#endif\n#if !(defined(LINE_ONLY) || defined(USE_SQUARE_PIN) || defined(USE_TRIANGLE_PIN))\nfloat line_join_distance_no_miter(in vec2 p,in vec2 corner,in vec2 unit_normal,in float offset,in int line_join){float dist_outside=dot((p-corner),unit_normal)-offset;if(line_join==bevel_join&&dist_outside>-0.5*u_antialias)return dist_outside+0.5*v_linewidth;else if(dist_outside>0.)return distance(p,corner);else return-v_linewidth-u_antialias;}\n#endif\n#if defined(USE_SQUARE_PIN) || defined(USE_TRIANGLE_PIN)\nfloat line_join_distance_incl_miter(in vec2 p,in vec2 corner,in vec2 unit_normal,in float offset,in int line_join,vec2 miter_unit_normal){float dist_outside=dot((p-corner),unit_normal)-offset;if(line_join==miter_join&&dist_outside>0.)return dot((p-corner),miter_unit_normal);else if(line_join==bevel_join&&dist_outside>-0.5*u_antialias)return dist_outside+0.5*v_linewidth;else if(dist_outside>0.)return distance(p,corner);else return-v_linewidth-u_antialias;}\n#endif\n#if defined(APPEND_CROSS) || defined(APPEND_X) || defined(USE_ASTERISK) || defined(USE_CROSS) || defined(USE_X)\nfloat one_cross(in vec2 p,in int line_cap,in float len){p=abs(p);p=(p.y>p.x)?p.yx:p.xy;float dist=p.y;float end_dist=end_cap_distance(p,vec2(len,0.),vec2(1.,0.),line_cap);return max(dist,end_dist);}\n#endif\n#ifdef APPEND_CROSS_2\nfloat one_cross_2(in vec2 p,in int line_cap,in vec2 lengths){p=abs(p);bool switch_xy=(p.y>p.x);p=switch_xy?p.yx:p.xy;float len=switch_xy?lengths.y:lengths.x;float dist=p.y;float end_dist=end_cap_distance(p,vec2(len,0.),vec2(1.,0.),line_cap);return max(dist,end_dist);}\n#endif\n#if defined(APPEND_Y) || defined(USE_Y)\nfloat one_y(in vec2 p,in int line_cap,in float len){p=vec2(abs(p.x),-p.y);const float k=6./sqrt(13.);vec2 unit_along=vec2(0.5*k,k/3.);vec2 end_point=vec2(0.5*len*SQRT3,len*SQRT3/3.);float dist=max(abs(dot(p,vec2(-unit_along.y,unit_along.x))),end_cap_distance(p,end_point,unit_along,line_cap));if(p.y<0.){float vert_dist=max(p.x,end_cap_distance(p,vec2(0.,-len),vec2(0.,-1.),line_cap));dist=min(dist,vert_dist);}return dist;}\n#endif\n#ifdef USE_ASTERISK\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){vec2 p_diag=vec2((p.x+p.y)/SQRT2,(p.x-p.y)/SQRT2);float len=0.5*v_size.x;return min(one_cross(p,line_cap,len),one_cross(p_diag,line_cap,len));}\n#endif\n#if defined(USE_ANNULUS) || defined(USE_WEDGE) || defined(USE_ANNULAR_WEDGE)\nfloat merge(in float d1,in float d2){return min(d1,d2);}float intersect(in float d1,in float d2){return max(d1,d2);}float subtract(in float d1,in float d2){return max(d1,-d2);}float circle(in vec2 p,in float radius){return length(p)-radius;}float segment_square(in vec2 p,in vec2 q){vec2 v=p-q*clamp(dot(p,q)/dot(q,q),0.,1.);return dot(v,v);}vec2 xy(in float angle){return vec2(cos(angle),sin(angle));}float cross_z(in vec2 v0,in vec2 v1){return v0.x*v1.y-v0.y*v1.x;}float wedge(in vec2 p,in float r,in float start_angle,in float end_angle){vec2 a=r*xy(start_angle);vec2 b=r*xy(end_angle);float d=sqrt(merge(segment_square(p,a),segment_square(p,b)));float s;if(cross_z(a,b)<0.){s=sign(max(cross_z(a,p),cross_z(p,b)));}else{s=-sign(max(cross_z(p,a),cross_z(b,p)));}return s*d;}float annulus(in vec2 p,in float outer_radius,in float inner_radius){float outer=circle(p,outer_radius);float inner=circle(p,inner_radius);return subtract(outer,inner);}\n#endif\n#if defined(USE_ANNULUS)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){return annulus(p,v_outer_radius,v_inner_radius);}\n#endif\n#if defined(USE_WEDGE)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){return intersect(circle(p,v_radius),wedge(p,v_radius,v_start_angle,v_end_angle));}\n#endif\n#if defined(USE_ANNULAR_WEDGE)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){return intersect(annulus(p,v_outer_radius,v_inner_radius),wedge(p,v_outer_radius,v_start_angle,v_end_angle));}\n#endif\n#if defined(USE_CIRCLE) || defined(USE_CIRCLE_CROSS) || defined(USE_CIRCLE_DOT) || defined(USE_CIRCLE_X) || defined(USE_CIRCLE_Y)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){return length(p)-0.5*v_size.x;}\n#endif\n#ifdef USE_CROSS\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){return one_cross(p,line_cap,0.5*v_size.x);}\n#endif\n#ifdef USE_DASH\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){p=abs(p);float dist=p.y;float end_dist=end_cap_distance(p,vec2(0.5*v_size.x,0.),vec2(1.,0.),line_cap);return max(dist,end_dist);}\n#endif\n#if defined(USE_DIAMOND) || defined(USE_DIAMOND_CROSS) || defined(USE_DIAMOND_DOT)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){p=abs(p);float r=0.5*v_size.x;const float SQRT13=sqrt(13.);float dist=dot(p,vec2(3.,2.))/SQRT13-2.*r/SQRT13;if(line_join!=miter_join){dist=max(dist,line_join_distance_no_miter(p,vec2(0.,r),vec2(0.,1.),v_linewidth/SQRT13,line_join));dist=max(dist,line_join_distance_no_miter(p,vec2(r*2./3.,0.),vec2(1.,0.),v_linewidth*(1.5/SQRT13),line_join));}return dist;}\n#endif\n#ifdef USE_DOT\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){return v_linewidth+u_antialias;}\n#endif\n#if defined(USE_HEX_TILE) || defined(USE_HEX) || defined(USE_HEX_DOT)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){p=abs(p);float rx=v_size.x/2.;float h=v_size.y*(SQRT3/4.);float len_normal=sqrt(h*h+0.25*rx*rx);vec2 unit_normal=vec2(h,0.5*rx)/len_normal;float dist=max(dot(p,unit_normal)-rx*h/len_normal,p.y-h);if(line_join!=miter_join){dist=max(dist,line_join_distance_no_miter(p,vec2(rx,
580.),vec2(1.,0.),0.5*v_linewidth*unit_normal.x,line_join));unit_normal=normalize(unit_normal+vec2(0.,1.));dist=max(dist,line_join_distance_no_miter(p,vec2(0.5*rx,h),unit_normal,0.5*v_linewidth*unit_normal.y,line_join));}return dist;}\n#endif\n#ifdef USE_NGON\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){float side_angle=2.*PI/v_n;p.y=-p.y;float angle=mod(atan(p.x,p.y),side_angle);angle=min(angle,side_angle-angle);p=length(p)*vec2(sin(angle),cos(angle));float half_angle=0.5*side_angle;float cos_half_angle=cos(half_angle);vec2 unit_normal=vec2(sin(half_angle),cos_half_angle);vec2 corner=vec2(0.,v_size.y/2.);float dist=dot(p-corner,unit_normal);if(line_join!=miter_join){dist=max(dist,line_join_distance_no_miter(p,corner,vec2(0.,1.),0.5*v_linewidth*cos_half_angle,line_join));}return dist;}\n#endif\n#ifdef USE_PLUS\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){p=abs(p);p=(p.y>p.x)?p.yx:p.xy;float r=0.5*v_size.x;p=p-vec2(r,0.375*r);float dist=max(p.x,p.y);if(line_join!=miter_join){dist=max(dist,line_join_distance_no_miter(p,vec2(0.,0.),vec2(1./SQRT2,1./SQRT2),v_linewidth/(2.*SQRT2),line_join));dist=min(dist,-line_join_distance_no_miter(p,vec2(-5.*r/8.,0.),vec2(-1./SQRT2,-1./SQRT2),v_linewidth/(2.*SQRT2),line_join));}return dist;}\n#endif\n#if defined(USE_ROUND_RECT)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){vec2 halfsize=v_size/2.;vec2 p2=abs(p)-halfsize;float dist=max(p2.x,p2.y);if(line_join!=miter_join){dist=max(dist,line_join_distance_no_miter(p2,vec2(0.,0.),vec2(1./SQRT2,1./SQRT2),v_linewidth/(2.*SQRT2),line_join));}vec4 border_radius=v_border_radius;vec4 xsign=vec4(-1.,1.,1.,-1.);vec4 ysign=vec4(-1.,-1.,1.,1.);for(int i=0;i<4;i++){float radius=border_radius.x;p2=p*vec2(xsign.x,ysign.x);vec2 offset=p2-halfsize+radius;if(min(radius,min(offset.x,offset.y))>0.){dist=max(dist,length(offset)-radius);}border_radius.xyzw=border_radius.yzwx;xsign.xyzw=xsign.yzwx;ysign.xyzw=ysign.yzwx;}return dist;}\n#endif\n#if defined(USE_RECT) || defined(USE_SQUARE) || defined(USE_SQUARE_CROSS) || defined(USE_SQUARE_DOT) || defined(USE_SQUARE_X)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){vec2 p2=abs(p)-v_size/2.;float dist=max(p2.x,p2.y);if(line_join!=miter_join){dist=max(dist,line_join_distance_no_miter(p2,vec2(0.,0.),vec2(1./SQRT2,1./SQRT2),v_linewidth/(2.*SQRT2),line_join));}return dist;}\n#endif\n#ifdef USE_SQUARE_PIN\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){p=abs(p);p=(p.y>p.x)?p.yx:p.xy;float r=0.5*v_size.x;float center_x=r*2.44375;float radius=r*1.75626;float dist=radius-distance(p,vec2(center_x,0.));dist=max(dist,line_join_distance_incl_miter(p,vec2(r,r),vec2(1./SQRT2,1./SQRT2),v_linewidth*0.1124297533493792,line_join,vec2(8./sqrt(89.),-5./sqrt(89.))));return dist;}\n#endif\n#if defined(USE_STAR) || defined(USE_STAR_DOT)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){const float SQRT5=sqrt(5.);const float COS72=0.25*(SQRT5-1.);const float SIN72=sqrt((5.+SQRT5)/8.);float angle=atan(p.x,p.y);angle=mod(angle,0.4*PI)-0.2*PI;p=length(p)*vec2(cos(angle),abs(sin(angle)));float r=0.5*v_size.x;float a=r*sqrt(5.-2.*SQRT5);float dist=dot(p,vec2(COS72,SIN72))-r*COS72;if(line_join!=miter_join){dist=max(dist,line_join_distance_no_miter(p,vec2(r,0.),vec2(1.,0.),v_linewidth*(0.5*COS72),line_join));const float COS36=sqrt(0.5+COS72/2.);const float SIN36=sqrt(0.5-COS72/2.);dist=min(dist,-line_join_distance_no_miter(p,vec2(r-a*SIN72,a*COS72),vec2(-COS36,-SIN36),v_linewidth*(0.5*COS36),line_join));}return dist;}\n#endif\n#if defined(USE_TRIANGLE) || defined(USE_TRIANGLE_DOT) || defined(USE_INVERTED_TRIANGLE)\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){float r=0.5*v_size.x;float a=r*SQRT3/3.;\n#ifdef USE_INVERTED_TRIANGLE\np=vec2(abs(p.x),-p.y);\n#else\np=vec2(abs(p.x),p.y);\n#endif\nfloat dist=max(0.5*dot(p,vec2(SQRT3,-1.))-a,p.y-a);if(line_join!=miter_join){dist=max(dist,line_join_distance_no_miter(p,vec2(0.,-(2./SQRT3)*r),vec2(0.,-1.),v_linewidth*0.25,line_join));dist=max(dist,line_join_distance_no_miter(p,vec2(r,a),vec2(SQRT3/2.,0.5),v_linewidth*0.25,line_join));}return dist;}\n#endif\n#ifdef USE_TRIANGLE_PIN\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){float angle=atan(p.x,-p.y);angle=mod(angle,PI*2./3.)-PI/3.;p=length(p)*vec2(cos(angle),abs(sin(angle)));const float a=1./SQRT3;const float b=SQRT3/8.;const float c=(a-b)/2.;const float x=(1.-c*c)/(2.*c);const float center_x=x+a;const float radius=x+c;float r=0.5*v_size.x;float dist=r*radius-distance(p,vec2(r*center_x,0.));dist=max(dist,line_join_distance_incl_miter(p,vec2(a*r,r),vec2(0.5,0.5*SQRT3),v_linewidth*0.0881844526878324,line_join,vec2(8.*SQRT3,-5.)/sqrt(217.)));return dist;}\n#endif\n#ifdef USE_X\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){p=vec2((p.x+p.y)/SQRT2,(p.x-
58p.y)/SQRT2);return one_cross(p,line_cap,0.5*v_size.x);}\n#endif\n#ifdef USE_Y\nfloat marker_distance(in vec2 p,in int line_cap,in int line_join){return one_y(p,line_cap,0.5*v_size.x);}\n#endif\nfloat distance_to_fraction(in float dist){return 1.-smoothstep(-0.5*u_antialias,0.5*u_antialias,dist);}float fill_fraction(in float dist){return distance_to_fraction(dist);}float line_fraction(in float dist){return distance_to_fraction(abs(dist)-0.5*v_linewidth);}vec4 fractional_color(in vec4 color,in float fraction){color.a*=fraction;color.rgb*=color.a;return color;}vec4 blend_colors(in vec4 src,in vec4 dest){return(1.-src.a)*dest+src;}\n#ifdef APPEND_DOT\nfloat dot_fraction(in vec2 p){float radius=0.125*v_size.x;float dot_distance=max(length(p)-radius,-0.5*u_antialias);return fill_fraction(dot_distance);}\n#endif\n#ifdef HATCH\nfloat wrap(in float x){return fract(x)-0.5;}vec2 wrap(in vec2 xy){return fract(xy)-0.5;}float hatch_fraction(in vec2 coords,in int hatch_pattern){float scale=v_hatch_scale;coords=coords/scale;float halfwidth=0.5*v_hatch_weight/scale;float dist=u_antialias;if(hatch_pattern==hatch_dot){const float dot_radius=0.25;dist=length(wrap(coords))-dot_radius;}else if(hatch_pattern==hatch_ring){const float ring_radius=0.25;dist=abs(length(wrap(coords))-ring_radius)-halfwidth;}else if(hatch_pattern==hatch_horizontal_line){dist=abs(wrap(coords.y))-halfwidth;}else if(hatch_pattern==hatch_vertical_line){dist=abs(wrap(coords.x))-halfwidth;}else if(hatch_pattern==hatch_cross){dist=min(abs(wrap(coords.x)),abs(wrap(coords.y)))-halfwidth;}else if(hatch_pattern==hatch_horizontal_dash){const float halflength=0.25;dist=max(abs(wrap(coords.y)),abs(wrap(coords.x)+0.25)-halflength)-halfwidth;}else if(hatch_pattern==hatch_vertical_dash){const float halflength=0.25;dist=max(abs(wrap(coords.x)),abs(wrap(coords.y)+0.25)-halflength)-halfwidth;}else if(hatch_pattern==hatch_spiral){vec2 wrap2=wrap(coords);float angle=wrap(atan(wrap2.y,wrap2.x)/(2.*PI));const float dr=PI/15.;float radius=length(wrap2);float frac=fract((radius-dr*angle)/dr);dist=dr*(abs(frac-0.5));dist=min(dist,radius)-halfwidth;}else if(hatch_pattern==hatch_right_diagonal_line){dist=abs(wrap(2.*coords.x+coords.y))/sqrt(5.)-halfwidth;}else if(hatch_pattern==hatch_left_diagonal_line){dist=abs(wrap(2.*coords.x-coords.y))/sqrt(5.)-halfwidth;}else if(hatch_pattern==hatch_diagonal_cross){coords=vec2(coords.x+coords.y+0.5,coords.x-coords.y+0.5);dist=min(abs(wrap(coords.x)),abs(wrap(coords.y)))/SQRT2-halfwidth;}else if(hatch_pattern==hatch_right_diagonal_dash){float across=coords.x+coords.y+0.5;dist=abs(wrap(across))/SQRT2;across=floor(across);float along=wrap(0.5*(coords.x-coords.y+across));const float halflength=0.25;along=abs(along)-halflength;dist=max(dist,along)-halfwidth;}else if(hatch_pattern==hatch_left_diagonal_dash){float across=coords.x-coords.y+0.5;dist=abs(wrap(across))/SQRT2;across=floor(across);float along=wrap(0.5*(coords.x+coords.y+across));const float halflength=0.25;along=abs(along)-halflength;dist=max(dist,along)-halfwidth;}else if(hatch_pattern==hatch_horizontal_wave){float wrapx=wrap(coords.x);float wrapy=wrap(coords.y-0.25+abs(wrapx));dist=abs(wrapy)/SQRT2-halfwidth;}else if(hatch_pattern==hatch_vertical_wave){float wrapy=wrap(coords.y);float wrapx=wrap(coords.x-0.25+abs(wrapy));dist=abs(wrapx)/SQRT2-halfwidth;}else if(hatch_pattern==hatch_criss_cross){float plus=min(abs(wrap(coords.x)),abs(wrap(coords.y)));coords=vec2(coords.x+coords.y+0.5,coords.x-coords.y+0.5);float X=min(abs(wrap(coords.x)),abs(wrap(coords.y)))/SQRT2;dist=min(plus,X)-halfwidth;}return distance_to_fraction(dist*scale);}\n#endif\nvoid main(){int line_cap=int(v_line_cap+0.5);int line_join=int(v_line_join+0.5);\n#ifdef HATCH\nint hatch_pattern=int(v_hatch_pattern+0.5);\n#endif\nfloat dist=marker_distance(v_coords,line_cap,line_join);\n#ifdef LINE_ONLY\nvec4 color=vec4(0.,0.,0.,0.);\n#else\nfloat fill_frac=fill_fraction(dist);vec4 color=fractional_color(v_fill_color,fill_frac);\n#endif\n#if defined(HATCH) && !defined(LINE_ONLY)\nif(hatch_pattern>0&&fill_frac>0.){float hatch_frac=hatch_fraction(v_hatch_coords,hatch_pattern);vec4 hatch_color=fractional_color(v_hatch_color,hatch_frac*fill_frac);
58color=blend_colors(hatch_color,color);}\n#endif\nfloat line_frac=line_fraction(dist);\n#ifdef APPEND_DOT\nline_frac=max(line_frac,dot_fraction(v_coords));\n#endif\n#ifdef APPEND_CROSS\nline_frac=max(line_frac,line_fraction(one_cross(v_coords,line_cap,0.5*v_size.x)));\n#endif\n#ifdef APPEND_CROSS_2\nvec2 lengths=vec2(v_size.x/3.,v_size.x/2.);line_frac=max(line_frac,line_fraction(one_cross_2(v_coords,line_cap,lengths)));\n#endif\n#ifdef APPEND_X\nvec2 p=vec2((v_coords.x+v_coords.y)/SQRT2,(v_coords.x-v_coords.y)/SQRT2);line_frac=max(line_frac,line_fraction(one_cross(p,line_cap,APPEND_X_LEN)));\n#endif\n#ifdef APPEND_Y\nline_frac=max(line_frac,line_fraction(one_y(v_coords,line_cap,0.5*v_size.x)));\n#endif\nif(line_frac>0.){vec4 line_color=fractional_color(v_line_color,line_frac);color=blend_colors(line_color,color);}gl_FragColor=color;}"}, 59653: function _(a,t,e,c,i){c();e.default="\nprecision mediump float;attribute vec2 a_position;attribute vec4 a_fill_color;attribute float a_edge_distance;\n#ifdef HATCH\nattribute float a_hatch_pattern;attribute float a_hatch_scale;attribute float a_hatch_weight;attribute vec4 a_hatch_color;\n#endif\nuniform vec2 u_canvas_size;varying vec4 v_fill_color;varying float v_edge_distance;\n#ifdef HATCH\nvarying float v_hatch_pattern;varying float v_hatch_scale;varying float v_hatch_weight;varying vec4 v_hatch_color;varying vec2 v_hatch_coords;\n#endif\nvoid main(){v_fill_color=a_fill_color;v_edge_distance=a_edge_distance;\n#ifdef HATCH\nv_hatch_pattern=a_hatch_pattern;v_hatch_scale=a_hatch_scale;v_hatch_weight=a_hatch_weight;v_hatch_color=a_hatch_color;v_hatch_coords=a_position;\n#endif\nvec2 pos=a_position+0.5;pos/=u_canvas_size;gl_Position=vec4(2.*pos.x-1.,1.-2.*pos.y,0.,1.);}"}, 60654: function _(a,t,o,c,r){c();o.default="\nprecision mediump float;uniform float u_antialias;varying vec4 v_fill_color;varying float v_edge_distance;\n#ifdef HATCH\nconst float SQRT2=sqrt(2.);const float SQRT3=sqrt(3.);const float PI=3.14159265358979323846;const int hatch_dot=1;const int hatch_ring=2;const int hatch_horizontal_line=3;const int hatch_vertical_line=4;const int hatch_cross=5;const int hatch_horizontal_dash=6;const int hatch_vertical_dash=7;const int hatch_spiral=8;const int hatch_right_diagonal_line=9;const int hatch_left_diagonal_line=10;const int hatch_diagonal_cross=11;const int hatch_right_diagonal_dash=12;const int hatch_left_diagonal_dash=13;const int hatch_horizontal_wave=14;const int hatch_vertical_wave=15;const int hatch_criss_cross=16;varying float v_hatch_pattern;varying float v_hatch_scale;varying float v_hatch_weight;varying vec4 v_hatch_color;varying vec2 v_hatch_coords;float distance_to_fraction(in float dist){return 1.-smoothstep(-0.5*u_antialias,0.5*u_antialias,dist);}vec4 fractional_color(in vec4 color,in float fraction){color.a*=fraction;color.rgb*=color.a;return color;}vec4 blend_colors(in vec4 src,in vec4 dest){return(1.-src.a)*dest+src;}float wrap(in float x){return fract(x)-0.5;}vec2 wrap(in vec2 xy){return fract(xy)-0.5;}float hatch_fraction(in vec2 coords,in int hatch_pattern){float scale=v_hatch_scale;coords=coords/scale;float halfwidth=0.5*v_hatch_weight/scale;float dist=u_antialias;if(hatch_pattern==hatch_dot){const float dot_radius=0.25;dist=length(wrap(coords))-dot_radius;}else if(hatch_pattern==hatch_ring){const float ring_radius=0.25;dist=abs(length(wrap(coords))-ring_radius)-halfwidth;}else if(hatch_pattern==hatch_horizontal_line){dist=abs(wrap(coords.y))-halfwidth;}else if(hatch_pattern==hatch_vertical_line){dist=abs(wrap(coords.x))-halfwidth;}else if(hatch_pattern==hatch_cross){dist=min(abs(wrap(coords.x)),abs(wrap(coords.y)))-halfwidth;}else if(hatch_pattern==hatch_horizontal_dash){const float halflength=0.25;dist=max(abs(wrap(coords.y)),abs(wrap(coords.x)+0.25)-halflength)-halfwidth;}else if(hatch_pattern==hatch_vertical_dash){const float halflength=0.25;dist=max(abs(wrap(coords.x)),abs(wrap(coords.y)+0.25)-halflength)-halfwidth;}else if(hatch_pattern==hatch_spiral){vec2 wrap2=wrap(coords);float angle=wrap(atan(wrap2.y,wrap2.x)/(2.*PI));const float dr=PI/15.;float radius=length(wrap2);float frac=fract((radius-dr*angle)/dr);dist=dr*(abs(frac-0.5));dist=min(dist,radius)-halfwidth;}
60else if(hatch_pattern==hatch_right_diagonal_line){dist=abs(wrap(2.*coords.x+coords.y))/sqrt(5.)-halfwidth;}else if(hatch_pattern==hatch_left_diagonal_line){dist=abs(wrap(2.*coords.x-coords.y))/sqrt(5.)-halfwidth;}else if(hatch_pattern==hatch_diagonal_cross){coords=vec2(coords.x+coords.y+0.5,coords.x-coords.y+0.5);dist=min(abs(wrap(coords.x)),abs(wrap(coords.y)))/SQRT2-halfwidth;}else if(hatch_pattern==hatch_right_diagonal_dash){float across=coords.x+coords.y+0.5;dist=abs(wrap(across))/SQRT2;across=floor(across);float along=wrap(0.5*(coords.x-coords.y+across));const float halflength=0.25;along=abs(along)-halflength;dist=max(dist,along)-halfwidth;}else if(hatch_pattern==hatch_left_diagonal_dash){float across=coords.x-coords.y+0.5;dist=abs(wrap(across))/SQRT2;across=floor(across);float along=wrap(0.5*(coords.x+coords.y+across));const float halflength=0.25;along=abs(along)-halflength;dist=max(dist,along)-halfwidth;}else if(hatch_pattern==hatch_horizontal_wave){float wrapx=wrap(coords.x);float wrapy=wrap(coords.y-0.25+abs(wrapx));dist=abs(wrapy)/SQRT2-halfwidth;}else if(hatch_pattern==hatch_vertical_wave){float wrapy=wrap(coords.y);float wrapx=wrap(coords.x-0.25+abs(wrapy));dist=abs(wrapx)/SQRT2-halfwidth;}else if(hatch_pattern==hatch_criss_cross){float plus=min(abs(wrap(coords.x)),abs(wrap(coords.y)));coords=vec2(coords.x+coords.y+0.5,coords.x-coords.y+0.5);float X=min(abs(wrap(coords.x)),abs(wrap(coords.y)))/SQRT2;dist=min(plus,X)-halfwidth;}return distance_to_fraction(dist*scale);}\n#endif\nvoid main(){vec4 color=v_fill_color;color=vec4(color.rgb*color.a,color.a);\n#ifdef HATCH\nint hatch_pattern=int(v_hatch_pattern+0.5);if(hatch_pattern>0){float hatch_frac=hatch_fraction(v_hatch_coords,hatch_pattern);vec4 hatch_color=fractional_color(v_hatch_color,hatch_frac);color=blend_colors(hatch_color,color);}\n#endif\nfloat edge_alpha=smoothstep(0.,u_antialias,v_edge_distance);color*=edge_alpha;gl_FragColor=color;}"}, 61655: function _(t,e,r,s,n){s();const a=t(656);class AnnularWedgeGL extends a.SXSYGlyphGL{glyph;constructor(t,e){super(t,e),this.glyph=e}get marker_type(){return"annular_wedge"}get outer_radius(){return this._widths}get inner_radius(){return this._heights}get start_angle(){return this._angles}get end_angle(){return this._auxs}_set_data(){super._set_data(),this.outer_radius.set_from_array(this.glyph.souter_radius),this.inner_radius.set_from_array(this.glyph.sinner_radius),"anticlock"==this.glyph.model.direction?(this.start_angle.set_from_prop(this.glyph.start_angle),this.end_angle.set_from_prop(this.glyph.end_angle)):(this.start_angle.set_from_prop(this.glyph.end_angle),this.end_angle.set_from_prop(this.glyph.start_angle))}}r.AnnularWedgeGL=AnnularWedgeGL}, 62656: function _(s,t,e,i,n){i();const h=s(657),r=s(661);class SXSYGlyphGL extends h.SingleMarkerGL{glyph;constructor(s,t){super(s,t),this.glyph=t}_set_data(){const s=this.nvertices,t=this._centers.get_sized_array(2*s);(0,r.interleave)(this.glyph.sx,this.glyph.sy,s,h.SingleMarkerGL.missing_point,t),this._centers.update()}}e.SXSYGlyphGL=SXSYGlyphGL}, 63657: function _(a,s,t,e,h){e();const i=a(658);class SingleMarkerGL extends i.BaseMarkerGL{glyph;constructor(a,s){super(a,s),this.glyph=s}_get_visuals(){return this.glyph.visuals}draw(a,s,t){this._draw_impl(a,t,s.glglyph)}_draw_impl(a,s,t){(t.data_changed||t.data_mapped)&&(t.set_data(),t.data_changed=!1,t.data_mapped=!1),this!==t&&this.data_changed&&(this.set_data(),this.data_changed=!1),this.visual
63s_changed&&(this._set_visuals(),this.visuals_changed=!1);const e=t.nvertices,h=this._show.length,i=this._show.get_sized_array(e);if(a.length<e){this._show_all=!1,i.fill(0);for(let s=0;s<a.length;s++)i[a[s]]=255}else this._show_all&&h==e||(this._show_all=!0,i.fill(255));this._show.update(),this._draw_one_marker_type(t.marker_type,s,t)}}t.SingleMarkerGL=SingleMarkerGL}, 64658: function _(e,t,r,s,h){s();const i=e(659),a=e(660),l=e(661);class BaseMarkerGL extends i.BaseGLGlyph{_antialias=1.5;_centers=new a.Float32Buffer(this.regl_wrapper);_widths=new a.Float32Buffer(this.regl_wrapper);_heights=new a.Float32Buffer(this.regl_wrapper);_angles=new a.Float32Buffer(this.regl_wrapper);_auxs=new a.Float32Buffer(this.regl_wrapper);_border_radius=[0,0,0,0];_border_radius_nonzero=!1;_show=new a.Uint8Buffer(this.regl_wrapper);_show_all=!1;_linewidths=new a.Float32Buffer(this.regl_wrapper);_line_caps=new a.Uint8Buffer(this.regl_wrapper);_line_joins=new a.Uint8Buffer(this.regl_wrapper);_line_rgba=new a.NormalizedUint8Buffer(this.regl_wrapper,4);_fill_rgba=new a.NormalizedUint8Buffer(this.regl_wrapper,4);_have_hatch=!1;_hatch_patterns=new a.Uint8Buffer(this.regl_wrapper);_hatch_scales=new a.Float32Buffer(this.regl_wrapper);_hatch_weights=new a.Float32Buffer(this.regl_wrapper);_hatch_rgba=new a.NormalizedUint8Buffer(this.regl_wrapper,4);static missing_point=-1e4;marker_props(e,t){const r=e!==t&&e._widths.length>0,s=e!==t&&e._heights.length>0,h=e!==t&&e._angles.length>0,i=e!==t&&e._auxs.length>0;return{width:r?e._widths:t._widths,height:s?e._heights:t._heights,angle:h?e._angles:t._angles,aux:i?e._auxs:t._auxs,border_radius:t._border_radius}}get line_props(){return{linewidth:this._linewidths,line_color:this._line_rgba,line_cap:this._line_caps,line_join:this._line_joins}}get fill_props(){return{fill_color:this._fill_rgba}}get hatch_props(){return{hatch_pattern:this._hatch_patterns,hatch_scale:this._hatch_scales,hatch_weight:this._hatch_weights,hatch_color:this._hatch_rgba}}_draw_one_marker_type(e,t,r){const s={scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:[t.width,t.height],size_hint:(0,l.marker_type_to_size_hint)(e),nmarkers:r.nvertices,antialias:this._antialias/t.pixel_ratio,show:this._show,center:r._centers,...this.marker_props(this,r),...this.line_props,...this.fill_props};if(this._have_hatch){const t={...s,...this.hatch_props};this.regl_wrapper.marker_hatch(e)(t)}else{this.regl_wrapper.marker_no_hatch(e)(s)}}_did_set_once=!1;set_data(){this._did_set_once||(this._did_set_once=!0,this._set_once()),this._set_data()}_set_once(){}_set_visuals(){const{line:e,fill:t,hatch:r}
64=this._get_visuals();this._linewidths.set_from_prop(e.line_width),this._line_caps.set_from_line_cap(e.line_cap),this._line_joins.set_from_line_join(e.line_join),this._line_rgba.set_from_color(e.line_color,e.line_alpha),this._fill_rgba.set_from_color(t.fill_color,t.fill_alpha),this._have_hatch=r.doit,this._have_hatch&&(this._hatch_patterns.set_from_hatch_pattern(r.hatch_pattern),this._hatch_scales.set_from_prop(r.hatch_scale),this._hatch_weights.set_from_prop(r.hatch_weight),this._hatch_rgba.set_from_color(r.hatch_color,r.hatch_alpha))}}r.BaseMarkerGL=BaseMarkerGL}, 65659: function _(e,a,t,s,i){s();t.BaseGLGlyph=class BaseGLGlyph{regl_wrapper;glyph;nvertices=0;size_changed=!1;data_changed=!1;data_mapped=!1;visuals_changed=!1;constructor(e,a){this.regl_wrapper=e,this.glyph=a}set_data_changed(){const{data_size:e}=this.glyph;e!=this.nvertices&&(this.nvertices=e,this.size_changed=!0),this.data_changed=!0}set_data_mapped(){this.data_mapped=!0}set_visuals_changed(){this.visuals_changed=!0}render(e,a,t){if(0==a.length)return;const{width:s,height:i}=this.glyph.renderer.plot_view.canvas_view.webgl.canvas,{pixel_ratio:h}=this.glyph.renderer.plot_view.canvas_view,d={pixel_ratio:h,width:s/h,height:i/h};this.draw(a,t,d)}}}, 66660: function _(r,t,e,a,s){a(),e.expand_to_per_vertex=function(r,t,e,a){const s=r.get_array();let i=0;for(const r of e)i+=r;const n=t.get_sized_array(i*a);let l=0;for(let t=0;t<e.length;t++){const i=r.is_scalar_value?0:t*a;for(let r=0;r<e[t];r++)for(let r=0;r<a;r++)n[l++]=s[i+r]}t.update()};const i=r(661),n=r(13),l=r(23);class WrappedBuffer{regl_wrapper;buffer;array;is_scalar;elements_per_primitive;constructor(r,t=1){this.regl_wrapper=r,this.is_scalar=!0,this.elements_per_primitive=t}get_array(){return(0,n.assert)(null!=this.array,"WrappedBuffer not yet initialised"),this.array}get_sized_array(r){return null!=this.array&&this.array.length==r||(this.array=this.new_array(r)),this.array}is_normalized(){return!1}get length(){return null!=this.array?this.array.length:0}get is_scalar_value(){return this.is_scalar}set_from_array(r){const t=r.length,e=this.get_sized_array(t);for(let a=0;a<t;a++)e[a]=r[a];this.update()}set_from_prop(r){const t=r.is_Scalar()?1:r.length,e=this.get_sized_array(t);for(let a=0;a<t;a++)e[a]=r.get(a);this.update(r.is_Scalar())}set_from_scalar(r){this.get_sized_array(1).fill(r),this.update(!0)}to_per_vertex_config(){return{buffer:this.buffer,divisor:0,normalized:this.is_normalized(),offset:0}}to_attribute_config(r=0,t=1){return{buffer:this.buffer,divisor:this.is_scalar?t:1,normalized:this.is_normalized(),offset:r*this.bytes_per_element()}}to_attribute_config_nested(r=0,t=1){return{buffer:this.buffer,divisor:t*this.elements_per_primitive,normalized:this.is_normalized(),offset:this.is_scalar?0:r*this.bytes_per_element()*this.elements_per_primitive}}extract_at(r,t,e){if(this.is_scalar)return this;const a=this.get_array(),s=e.get_sized_array(t),i=r*t;for(let r=0;r<t;r++)s[r]=a[i+r];return e.update(!0),e}update(r=!1){null==this.buffer?this.buffer=this.regl_wrapper.buffer({usage:"dynamic",data:this.array}):this.buffer({data:this.array}),this.is_scalar=r}}e.Float32Buffer=class Float32Buffer extends WrappedBuffer{bytes_per_element(){return Float32Array.BYTES_PER_ELEMENT}new_array(r){return new Float32Array(r)}};class Uint8Buffer extends WrappedBuffer{bytes_per_element(){return Uint8Array.BYTES_PER_ELEMENT}new_array(r){return new Uint8Array(r)}set_from_color(r,t){const e=r.is_Scalar(),a=e&&t.is_Scalar(),s=a?1:r.length;if(!e){const e=new Uint8Array(r.copy_buffer());for(let r=0;r<s;r++){const a=t.get(r);e[4*r+3]=(0,l.byte)(a*e[4*r+3])}return this.array=e,void this.update(a)}const i=this.get_sized_array(4*s);for(let e=0;e<s;e++){const[a,s,n,f]=(0,l.color2rgba)(r.get(e),t.get(e));i[4*e]=a,i[4*e+1]=s,i[4*e+2]=n,i[4*e+3]=f}this.update(a)}set_from_hatch_pattern(r){const t=r.is_Scalar()?1:r.length,e=this.get_sized_array(t);for(let a=0;a<t;a++)e[a]=(0,i.hatch_pattern_to_index)(r.get(a));this.update(r.is_Scalar())}set_from_line_cap(r){const t=r.is_Scalar()?1:r.length,e=this.get_sized_array(t);for(let a=0;a<t;a++)e[a]=i.cap_lookup[r.get(a)];this.update(r.is_Scalar())}set_from_line_join(r){const t=r.is_Scalar()?1:r.length,e=this.get_sized_array(t);for(let a=0;a<t;a++)e[a]=i.join_lookup[r.get(a)];this.update(r.is_Scalar())}}e.Uint8Buffer=Uint8Buffer;e.NormalizedUint8Buffer=class NormalizedUint8Buffer extends Uint8Buffer{is_normalized(){return!0}}}, 67661: function _(e,a,t,n,r){n(),t.interleave=function(e,a,t,n,r){for(let i=0;i<t;i++){const t=e[i],s=a[i];isFinite(t+s)?(r[2*i]=t,r[2*i+1]=s):(r[2*i]=n,r[2*i+1]=n)}},t.hatch_pattern_to_index=function(e){return s[i.hatch_aliases[e]??e]??0},t.marker_type_to_size_hint=function(e){switch(e){case"dash":return 1;case"dot":return 2;case"diamond":case"diamond_cross":case"diamond_dot":return 3;case"hex":case"hex_tile":return 4;case"square_pin":return 5;case"inverted_triangle":case"ngon":case"triangle":case"triangle_dot":return 6;case"triangle_pin":return 7;case"star":case"star_dot":return 8;default:return 0}};const i=e(105);t.cap_lookup={butt:0,round:1,square:2},t.join_lookup={miter:0,round:1,bevel:2};const s={blank:0,dot:1,ring:2,horizontal_line:3,vertical_line:4,cross:5,horizontal_dash:6,vertical_dash:7,spiral:8,right_diagonal_line:9,left_diagonal_line:10,diagonal_cross:11,right_diagonal_dash:12,left_diagonal_dash:13,horizontal_wave:14,vertical_wave:15,criss_cross:16}}, 68662: function _(s,t,r,e,u){e();const n=s(656);class AnnulusGL extends n.SXSYGlyphGL{glyph;constructor(s,t){super(s,t),this.glyph=t}get marker_type(){return"annulus"}get outer_radius(){return this._widths}get inner_radius(){return this._heights}_set_data(){super._set_data(),this.outer_radius.set_from_array(this.glyph.souter_radius),this.inner_radius.set_from_array(this.glyph.sinner_radius)}_set_once(){super._set_once(),this._angles.set_from_scalar(0),this._auxs.set_from_scalar(0)}}r.AnnulusGL=AnnulusGL}, 69663: function _(s,e,i,t,l){t();const h=s(659),n=s(660),a=s(100);class BaseLineGL extends h.BaseGLGlyph{glyph;_antialias=1.5;_miter_limit=10;_points;_show;_linewidth=new n.Float32Buffer(this.regl_wrapper);_line_color=new n.NormalizedUint8Buffer(this.regl_wrapper,4);_line_cap=new n.Uint8Buffer(this.regl_wrapper);_line_join=new n.Uint8Buffer(this.regl_wrapper);_is_dashed=!1;_length_so_far;_dash_tex=[];_dash_tex_info;_dash_scale;_dash_offset;constructor(s,e){super(s,e),this.glyph=e}_draw_single(s,e,i,t,l,h,n=null){const a={scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:[e.width,e.height],antialias:this._antialias/e.pixel_ratio,miter_limit:this._miter_limit,points:s._points,show:n??s._show,nsegments:l,line
69width:this._linewidth,line_color:this._line_color,line_cap:this._line_cap,line_join:this._line_join,framebuffer:h,point_offset:t,line_offset:i};if(this._is_dashed&&null!=this._dash_tex[i]){const e={...a,length_so_far:s._length_so_far,dash_tex:this._dash_tex[i],dash_tex_info:this._dash_tex_info,dash_scale:this._dash_scale,dash_offset:this._dash_offset};this.regl_wrapper.dashed_line()(e)}else this.regl_wrapper.solid_line()(a)}_set_length_single(s,e,i){const t=s.length;let l=0;for(let h=0;h<t;h++)s[h]=l,1==i[h+1]?l+=Math.sqrt((e[2*h+4]-e[2*h+2])**2+(e[2*h+5]-e[2*h+3])**2):l=0}_set_points_single(s,e,i){const t=s.length/2-2,l=t>2&&e[0]==e[t-1]&&i[0]==i[t-1]&&isFinite(e[0]+i[0]);for(let l=1;l<t+1;l++)s[2*l]=e[l-1],s[2*l+1]=i[l-1];l?(s[0]=s[2*t-2],s[1]=s[2*t-1],s[2*t+2]=s[4],s[2*t+3]=s[5]):(s[0]=0,s[1]=0,s[2*t+2]=0,s[2*t+3]=0)}_set_show_single(s,e){const i=e.length/2-2;let t=isFinite(e[2]+e[3]);for(let l=1;l<i;l++){const i=isFinite(e[2*l+2]+e[2*l+3]);s[l]=t&&i?1:0,t=i}i>2&&e[0]==e[2*i-2]&&e[1]==e[2*i-1]?(s[0]=s[i-1],s[i]=s[1]):(s[0]=0,s[i]=0)}
69_set_visuals(){const s=this._get_visuals();this._line_color.set_from_color(s.line_color,s.line_alpha),this._linewidth.set_from_prop(s.line_width),this._line_cap.set_from_line_cap(s.line_cap),this._line_join.set_from_line_join(s.line_join);const{line_dash:e}=s;if(this._is_dashed=!(e.is_Scalar()&&0==e.get(0).length),this._is_dashed){null==this._dash_offset&&(this._dash_offset=new n.Float32Buffer(this.regl_wrapper)),this._dash_offset.set_from_prop(s.line_dash_offset);const i=e.length;null==this._dash_tex_info&&(this._dash_tex_info=new n.Float32Buffer(this.regl_wrapper,4));const t=this._dash_tex_info.get_sized_array(4*i);null==this._dash_scale&&(this._dash_scale=new n.Float32Buffer(this.regl_wrapper));const l=this._dash_scale.get_sized_array(i);for(let s=0;s<i;s++){const i=(0,a.resolve_line_dash)(e.get(s));if(i.length>0){const[e,h,n]=this.regl_wrapper.get_dash(i);this._dash_tex.push(h);for(let i=0;i<4;i++)t[4*s+i]=e[i];l[s]=n}else this._dash_tex.push(null),t.fill(0,4*s,4*(s+1)),l[s]=0}this._dash_tex_info.update(),this._dash_scale.update()}}}i.BaseLineGL=BaseLineGL}, 70664: function _(e,r,s,c,t){c();const l=e(665);class CircleGL extends l.RadialGL{glyph;constructor(e,r){super(e,r),this.glyph=r}get marker_type(){return"circle"}_set_once(){super._set_once(),this._angles.set_from_scalar(0)}}s.CircleGL=CircleGL}, 71665: function _(s,t,e,a,i){a();const r=s(656),h=s(14);class RadialGL extends r.SXSYGlyphGL{glyph;constructor(s,t){super(s,t),this.glyph=t}get size(){return this._widths}_set_data(){super._set_data(),this.size.set_from_array((0,h.mul)(this.glyph.sradius,2))}_set_once(){super._set_once(),this._heights.set_from_scalar(0)}}e.RadialGL=RadialGL}, 72666: function _(s,t,e,h,a){h();const r=s(656);class HexTileGL extends r.SXSYGlyphGL{glyph;constructor(s,t){super(s,t),this.glyph=t}get marker_type(){return"hex_tile"}_set_data(){super._set_data(),"pointytop"==this.glyph.model.orientation?(this._angles.set_from_scalar(.5*Math.PI),this._widths.set_from_scalar(2*this.glyph.svy[0]),this._heights.set_from_scalar(4*this.glyph.svx[4]/Math.sqrt(3))):(this._angles.set_from_scalar(0),this._widths.set_from_scalar(2*this.glyph.svx[0]),this._heights.set_from_scalar(4*this.glyph.svy[4]/Math.sqrt(3)))}_set_once(){super._set_once(),this._auxs.set_from_scalar(0)}}e.HexTileGL=HexTileGL}, 73667: function _(t,e,s,a,i){a();const n=t(659),h=t(660),l=t(13);class ImageGL extends n.BaseGLGlyph{glyph;_tex=[];_bounds=[];_image_changed=!1;constructor(t,e){super(t,e),this.glyph=e}draw(t,e,s){const a=e.glglyph;(a.data_changed||a.data_mapped)&&a._set_data(),(a._image_changed||a.data_changed)&&a._set_image(),a.data_changed=!1,a.data_mapped=!1,a._image_changed=!1;const{global_alpha:i}=this.glyph.visuals.image;for(const e of t){if(null==a._tex[e]||null==a._bounds[e])continue;const t={scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:[s.width,s.height],bounds:a._bounds[e],tex:a._tex[e],global_alpha:i.get(e)};this.regl_wrapper.image()(t)}}set_image_changed(){this._image_changed=!0}_set_data(){const{image:t}=this.glyph,e=t.length;this._bounds.length!=e&&(this._bounds=Array(e).fill(null));for(let t=0;t<e;t++){const{sx:e,sy:s,sdw:a,sdh:i,xy_anchor:n,xy_scale:l,xy_sign:g}=this.glyph,o=e[t],d=s[t],r=a[t],u=i[t];if(!isFinite(o+d+r+u)){this._bounds[t]=null;continue}null==this._bounds[t]&&(this._bounds[t]=new h.Float32Buffer(this.regl_wrapper));const c=this._bounds[t].get_sized_array(4);c[0]=e[t]+a[t]*(.5*(1-l.x)-n.x)*g.x,c[1]=s[t]+i[t]*(.5*(1-l.y)-n.y)*g.y,c[2]=c[0]+a[t]*l.x*g.x,c[3]=c[1]+i[t]*l.y*g.y,this._bounds[t].update()}}_set_image(){const{image:t,image_data:e}=this.glyph,s=t.length;(0,l.assert)(null!=e),this._tex.length!=s&&(this._tex=Array(s).fill(null));for(let t=0;t<s;t++){const s=e[t];if(null==s){this._tex[t]=null;continue}const a={width:s.width,height:s.height,data:s,format:"rgba",type:"uint8"};null==this._tex[t]?this._tex[t]=this.regl_wrapper.texture(a):this._tex[t](a)}}}s.ImageGL=ImageGL}, 74668: function _(t,s,e,i,n){i();const h=t(660),l=t(669);class LineGL extends l.SingleLineGL{glyph;constructor(t,s){super(t,s),this.glyph=s}draw(t,s,e){this._draw_impl(t,e,s.glglyph)}_get_show_buffer(t,s){const e=s._show;let i=e;if(t.length!=e.length-1){const s=this.glyph.parent.nonselection_glyph==this.glyph,n=e.length,l=e.get_sized_array(n);null==this._show&&(this._show=new h.Uint8Buffer(this.regl_wrapper));const r=this._show.get_sized_array(n);r.fill(0);let o=t[0];s&&o>0&&(r[o]=l[o]);for(let e=1;e<t.length;e++){const i=t[e];i==o+1?r[i]=l[i]:s&&(r[o+1]=l[o+1],r[i]=l[i]),o=i}s&&o!=n-2&&(r[o+1]=l[o+1]),this._show.update(),i=this._show}return i}
74_get_visuals(){return this.glyph.visuals.line}_set_data_points(){const t=this.glyph.sx,s=this.glyph.sy,e=t.length;null==this._points&&(this._points=new h.Float32Buffer(this.regl_wrapper));const i=this._points.get_sized_array(2*(e+2));return this._set_points_single(i,t,s),this._points.update(),i}}e.LineGL=LineGL}, 75669: function _(s,t,e,a,h){a();const i=s(663),n=s(660);class SingleLineGL extends i.BaseLineGL{glyph;constructor(s,t){super(s,t),this.glyph=t}_draw_impl(s,t,e){this.visuals_changed&&(this._set_visuals(),this.visuals_changed=!1);const a=e.data_changed||e.data_mapped;a&&e._set_data(e.data_changed),(a&&e._is_dashed||this._is_dashed)&&e._set_length(),a&&(e.data_changed=!1,e.data_mapped=!1);const h=this._get_show_buffer(s,e),i=e._points.length/2-2-1;this._draw_single(e,t,0,0,i,null,h)}_set_data(s){const t=this._set_data_points();if(s){const s=t.length/2-2;null==this._show&&(this._show=new n.Uint8Buffer(this.regl_wrapper));const e=this._show.get_sized_array(s+1);this._set_show_single(e,t),this._show.update()}}_set_length(){const s=this._points.get_array(),t=this._show.get_array(),e=s.length/2-2;null==this._length_so_far&&(this._length_so_far=new n.Float32Buffer(this.regl_wrapper));const a=this._length_so_far.get_sized_array(e-1);this._set_length_single(a,s,t),this._length_so_far.update()}}e.SingleLineGL=SingleLineGL}, 76670: function _(t,s,r,e,i){e();const o=t(657),{abs:h}=Math;class LRTBGL extends o.SingleMarkerGL{glyph;constructor(t,s){super(t,s),this.glyph=s}get marker_type(){return this._border_radius_nonzero?"round_rect":"rect"}_set_data(){const t=this.nvertices,s=this._centers.get_sized_array(2*t),r=this._widths.get_sized_array(t),e=this._heights.get_sized_array(t),{sleft:i,sright:a,stop:n,sbottom:d}=this.glyph,{missing_point:u}=o.SingleMarkerGL;for(let o=0;o<t;o++){const t=i[o],g=a[o],l=n[o],c=d[o];isFinite(t+g+l+c)?(s[2*o]=(t+g)/2,s[2*o+1]=(l+c)/2,r[o]=h(g-t),e[o]=h(l-c)):(s[2*o]=u,s[2*o+1]=u,r[o]=u,e[o]=u)}if(this._centers.update(),this._widths.update(),this._heights.update(),this._angles.set_from_scalar(0),null!=this.glyph.border_radius){const{top_left:t,top_right:s,bottom_right:r,bottom_left:e}=this.glyph.border_radius;this._border_radius=[t,s,r,e],this._border_radius_nonzero=Math.max(...this._border_radius)>0}else this._border_radius=[0,0,0,0],this._border_radius_nonzero=!1}_set_once(){super._set_once(),this._auxs.set_from_scalar(0)}}r.LRTBGL=LRTBGL}, 77671: function _(s,t,e,a,h){a();const i=s(663),l=s(660);class MultiLineGL extends i.BaseLineGL{glyph;constructor(s,t){super(s,t),this.glyph=t}draw(s,t,e){this.visuals_changed&&(this._set_visuals(),this.visual
77s_changed=!1);const a=t.glglyph,h=a.data_changed||a.data_mapped;h&&a._set_data(a.data_changed),(h&&a._is_dashed||this._is_dashed)&&a._set_length(),h&&(a.data_changed=!1,a.data_mapped=!1);const{data_size:i}=this.glyph;let l=null,r=null;i>1&&([l,r]=this.regl_wrapper.framebuffer_and_texture);let n=0,g=-1;for(const h of s){for(let s=g+1;s<h;s++){n+=2*(t.sxs.get(s).length+2)}const s=t.sxs.get(h).length,i=s-1;if(null!=l&&this.regl_wrapper.clear_framebuffer(l),this._draw_single(a,e,h,n,i,l),null!=l){const s={scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,framebuffer_tex:r};this.regl_wrapper.accumulate()(s)}n+=2*(s+2),g=h}}_get_visuals(){return this.glyph.visuals.line}_set_data(s){const t=this.glyph.data_size,e=this.glyph.sxs.data.length;null==this._points&&(this._points=new l.Float32Buffer(this.regl_wrapper));const a=this._points.get_sized_array(2*(e+2*t));let h=0;for(let s=0;s<t;s++){const t=this.glyph.sxs.get(s),e=this.glyph.sys.get(s),i=t.length,l=a.subarray(h,h+2*(i+2));this._set_points_single(l,t,e),h+=2*(i+2)}if(this._points.update(),s){null==this._show&&(this._show=new l.Uint8Buffer(this.regl_wrapper));const s=this._show.get_sized_array(e+t);let h=0,i=0;for(let e=0;e<t;e++){const t=this.glyph.sxs.get(e).length,l=a.subarray(h,h+2*(t+2)),r=s.subarray(i,i+t+1);this._set_show_single(r,l),h+=2*(t+2),i+=t+1}this._show.update()}}_set_length(){const s=this.glyph.data_size,t=this.glyph.sxs.data.length,e=this._points.get_array(),a=this._show.get_array();null==this._length_so_far&&(this._length_so_far=new l.Float32Buffer(this.regl_wrapper));const h=this._length_so_far.get_sized_array(t-s);let i=0,r=0,n=0;for(let t=0;t<s;t++){const s=this.glyph.sxs.get(t).length,l=s-1,g=e.subarray(i,i+2*(s+2)),o=a.subarray(r,r+s+1),p=h.subarray(n,n+l);this._set_length_single(p,g,o),i+=2*(s+2),r+=s+1,n+=l}this._length_so_far.update()}}e.MultiLineGL=MultiLineGL}, 78672: function _(t,e,s,i,h){i();const a=t(1),r=t(659),n=t(660),l=t(100),o=t(643),p=t(673),c=a.__importDefault(t(674));class PatchGL extends r.BaseGLGlyph{glyph;_positions;_edge_distance;_elements=null;_pv_fill_color=new n.NormalizedUint8Buffer(this.regl_wrapper,4);_pv_hatch_patterns=new n.Uint8Buffer(this.regl_wrapper);_pv_hatch_scales=new n.Float32Buffer(this.regl_wrapper);_pv_hatch_weights=new n.Float32Buffer(this.regl_wrapper);_pv_hatch_rgba=new n.NormalizedUint8Buffer(this.regl_wrapper,4);_fill_color=new n.NormalizedUint8Buffer(this.regl_wrapper,4);_have_hatch=!1;_hatch_patterns=new n.Uint8Buffer(this.regl_wrapper);_hatch_scales=new n.Float32Buffer(this.regl_wrapper);_hatch_weights=new n.Float32Buffer(this.regl_wrapper);_hatch_rgba=new n.NormalizedUint8Buffer(this.regl_wrapper,4);_line_points_buf;_line_show_buf;_linewidth=new n.Float32Buffer(this.regl_wrapper);_line_color=new n.NormalizedUint8Buffer(this.regl_wrapper,4);_line_cap=new n.Uint8Buffer(this.regl_wrapper);_line_join=new n.Uint8Buffer(this.regl_wrapper);_is_dashed=!1;_length_so_far_buf;_dash_tex=[];_dash_tex_info;_dash_scale;_dash_offset;_triangle_count=0;_nvertices=0;_ring_data=[];_pv_dirty=!0;_topology;constructor(t,e){super(t,e),this.glyph=e}draw(t,e,s){const i=e.glglyph,h=this!==i&&this.data_changed;
78this.visuals_changed&&(this._set_visuals(),this.visuals_changed=!1,this._pv_dirty=!0);const a=i.data_changed;if((a||i.data_mapped)&&(i._set_data(a),i.data_changed=!1,i.data_mapped=!1,this._pv_dirty||=a||h),this!==i&&(this.data_changed||this.data_mapped)&&(this.data_changed=!1,this.data_mapped=!1,this._pv_dirty=!0),0==i._triangle_count&&0==i._ring_data.length)return;if(this._pv_dirty&&i._nvertices>0){const t=[i._nvertices];(0,n.expand_to_per_vertex)(this._fill_color,this._pv_fill_color,t,4),this._have_hatch&&((0,n.expand_to_per_vertex)(this._hatch_patterns,this._pv_hatch_patterns,t,1),(0,n.expand_to_per_vertex)(this._hatch_scales,this._pv_hatch_scales,t,1),(0,n.expand_to_per_vertex)(this._hatch_weights,this._pv_hatch_weights,t,1),(0,n.expand_to_per_vertex)(this._hatch_rgba,this._pv_hatch_rgba,t,4)),this._pv_dirty=!1}const{width:r,height:l}=s,o=[r,l];if(i._triangle_count>0&&null!=i._elements){this.glyph.visuals.fill.doit&&(this._have_hatch?this.regl_wrapper.polygon_hatch()({scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:o,positions:i._positions,fill_color:this._pv_fill_color,edge_distance:i._edge_distance,elements:i._elements,count:3*i._triangle_count,offset:0,antialias:p.POLYGON_AA_WIDTH/s.pixel_ratio,hatch_pattern:this._pv_hatch_patterns,hatch_scale:this._pv_hatch_scales,hatch_weight:this._pv_hatch_weights,hatch_color:this._pv_hatch_rgba}):this.regl_wrapper.polygon()({scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:o,positions:i._positions,fill_color:this._pv_fill_color,edge_distance:i._edge_distance,elements:i._elements,count:3*i._triangle_count,offset:0,antialias:p.POLYGON_AA_WIDTH/s.pixel_ratio}))}if(i._ring_data.length>0){if(this.glyph.visuals.line.doit)for(const t of i._ring_data){if(t.nline<2)continue;const e=t.nline-1,[i,h]=this.regl_wrapper.framebuffer_and_texture;this.regl_wrapper.clear_framebuffer(i),null==this._line_points_buf&&(this._line_points_buf=new n.Float32Buffer(this.regl_wrapper));this._line_points_buf.get_sized_array(t.points.length).set(t.points),this._line_points_buf.update(),null==this._line_show_buf&&(this._line_show_buf=new n.Uint8Buffer(this.regl_wrapper));if(this._line_show_buf.get_sized_array(t.show.length).set(t.show),this._line_show_buf.update(),this._is_dashed){null==this._length_so_far_buf&&(this._length_so_far_buf=new n.Float32Buffer(this.regl_wrapper));this._length_so_far_buf.get_sized_array(t.length_so_far.length).set(t.length_so_far),this._length_so_far_buf.update()}const a={scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:o,antialias:1.5/s.pixel_ratio,miter_limit:10,points:this._line_points_buf,show:this._line_show_buf,nsegments:e,linewidth:this._linewidth,line_color:this._line_color,line_cap:this._line_cap,line_join:this._line_join,framebuffer:i,point_offset:0,line_offset:0};if(this._is_dashed&&null!=this._dash_tex[0]){const t={...a,length_so_far:this._length_so_far_buf,dash_tex:this._dash_tex[0],dash_tex_info:this._dash_tex_info,dash_scale:this._dash_scale,dash_offset:this._dash_offset};this.regl_wrapper.dashed_line()(t)}else this.regl_wrapper.solid_line()(a);const r={scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,framebuffer_tex:h};this.regl_wrapper.accumulate()(r)}}}_set_data(t=!0){const{sx:e,sy:s}=this.glyph,i=(0,p.split_rings)(e,s);if(i.length>0){const e=null==this._topology||this._topology.some(({ring_indices:t})=>t.some(t=>t>=i.length)),s=t||e;if(s){const t=(0,p.classify_rings)(i);this._topology=t.map(({flat_coords:t,rings:e})=>{const s=e.map(t=>i.indexOf(t)),h=[];let a=0;for(let t=0;t<e.length;t++)t>0&&h.push(a),a+=e[t].length/2;return{ring_indices:s,tri_indices:(0,c.default)(t,h.length>0?h:void 0,2)}})}let h=0,a=0,r=0,l=0;const o=[];for(const{ring_indices:t,tri_indices:e}of this._topology){const s=t.map(t=>i[t]),n=s.flat(),c=(0,p.generate_skirt_geometry)(n,s,e,p.POLYGON_AA_WIDTH);o.push(c),h+=c.nvertices,a+=c.ntriangles,r+=c.positions.length,l+=c.indices.length}this._triangle_count=a,this._nvertices=h,null==this._positions&&(this._positions=new n.Float32Buffer(this.regl_wrapper,2));const f=this._positions.get_sized_array(r);null==this._edge_distance&&(this._edge_distance=new n.Float32Buffer(this.regl_wrapper));const d=this._edge_distance.get_sized_array(h),g=s||null==this._elements?new Uint32Array(l):null;let u=0,w=0,v=0,m=0;for(const t of o){if(f.set(t.positions,u),u+=t.positions.length,d.set(t.edge_distance,w),w+=t.edge_distance.length,null!=g)for(let e=0;e<t.indices.length;e++)g[v+e]=t.indices[e]+m;v+=t.indices.length,m+=t.nvertices}
78this._positions.update(),this._edge_distance.update(),null!=g&&(this._elements?.destroy(),this._elements=this.regl_wrapper.elements({usage:"static",primitive:"triangles",data:g,type:"uint32"})),this._ring_data=[];for(const t of i){const e=(0,p.build_line_from_ring)(t);e.nline>0&&this._ring_data.push(e)}}else t&&(this._elements?.destroy(),this._elements=null,this._topology=[]),this._triangle_count=0,this._nvertices=0,this._ring_data=[]}_set_visuals(){const t=this.glyph.visuals.fill;this._fill_color.set_from_color(t.fill_color,t.fill_alpha);const e=this.glyph.visuals.line;this._line_color.set_from_color(e.line_color,e.line_alpha),this._linewidth.set_from_prop(e.line_width),this._line_cap.set_from_line_cap(e.line_cap),this._line_join.set_from_line_join(e.line_join);const{line_dash:s}=e,i=(0,o.normalize_dash_pattern)((0,l.resolve_line_dash)(s.get(0)));if(this._is_dashed=0!=i.length,this._dash_tex=[],this._is_dashed){null==this._dash_offset&&(this._dash_offset=new n.Float32Buffer(this.regl_wrapper)),this._dash_offset.set_from_prop(e.line_dash_offset),null==this._dash_tex_info&&(this._dash_tex_info=new n.Float32Buffer(this.regl_wrapper,4));const t=this._dash_tex_info.get_sized_array(4);null==this._dash_scale&&(this._dash_scale=new n.Float32Buffer(this.regl_wrapper));const s=this._dash_scale.get_sized_array(1),[h,a,r]=this.regl_wrapper.get_dash(i);this._dash_tex.push(a);for(let e=0;e<4;e++)t[e]=h[e];s[0]=r,this._dash_tex_info.update(!0),this._dash_scale.update(!0)}const h=this.glyph.visuals.hatch;this._have_hatch=h.doit,this._have_hatch&&(this._hatch_patterns.set_from_hatch_pattern(h.hatch_pattern),this._hatch_scales.set_from_prop(h.hatch_scale),this._hatch_weights.set_from_prop(h.hatch_weight),this._hatch_rgba.set_from_color(h.hatch_color,h.hatch_alpha))}}s.PatchGL=PatchGL}, 79673: function _(t,n,e,r,o){function l(t){const n=t.length/2;let e=0;for(let r=0;r<n;r++){const o=(r+1)%n;e+=t[2*r]*t[2*o+1]-t[2*o]*t[2*r+1]}return e}function s(t,n,e){const r=e.length/2;let o=!1;for(let l=0,s=r-1;l<r;s=l++){const r=e[2*l],i=e[2*l+1],a=e[2*s],c=e[2*s+1];i>n!=c>n&&t<(a-r)*(n-i)/(c-i)+r&&(o=!o)}return o}function i(t){let n=1/0,e=1/0,r=-1/0,o=-1/0;for(let l=0;l<t.length;l+=2){const s=t[l],i=t[l+1];n=Math.min(n,s),e=Math.min(e,i),r=Math.max(r,s),o=Math.max(o,i)}return{x0:n,y0:e,x1:r,y1:o}}function a(t,n){return t.x0<=n.x0&&t.y0<=n.y0&&t.x1>=n.x1&&t.y1>=n.y1}r(),e.split_rings=function(t,n){const e=Math.min(t.length,n.length),r=[];let o=[];for(let l=0;l<e;l++){const e=t[l],s=n[l];isFinite(e+s)?o.push(e,s):o.length>0&&(r.push(o),o=[])}o.length>0&&r.push(o);return r},e.generate_skirt_geometry=function(t,n,e,r){const o=t.length/2,s=e.length/3;if(o<3||0==s)return{positions:new Float32Array(t.length),edge_distance:new Float32Array(o).fill(r),indices:new Uint32Array(e),nvertices:o,ntriangles:s};let i=0;for(const t of n)i+=t.length/2;const a=o+i,c=s+2*i,f=new Float32Array(2*a),h=new Float32Array(a),g=new Uint32Array(3*c);for(let n=0;n<t.length;n++)f[n]=t[n];h.fill(r,0,o);for(let t=0;t<e.length;t++)g[t]=e[t];let u=o,y=3*s,A=0;for(let e=0;e<n.length;e++){const o=n[e],s=o.length/2;if(s<2){A+=s;continue}const i=l(o),a=0==e?Math.sign(i):-Math.sign(i);if(0==a){for(let n=0;n<s;n++){const e=t[2*(A+n)],r=t[2*(A+n)+1];f[2*u]=e,f[2*u+1]=r,h[u]=0;const o=A+n,l=A+(n+1)%s,i=u-n,a=i+n,c=i+(n+1)%s;g[y++]=o,g[y++]=l,g[y++]=c,g[y++]=o,g[y++]=c,g[y++]=a,u++}A+=s;continue}const c=new Float64Array(2*s);for(let t=0;t<s;t++){const n=(t+1)%s,e=o[2*n]-o[2*t],r=o[2*n+1]-o[2*t+1],l=Math.sqrt(e*e+r*r);l<1e-10?(c[2*t]=0,c[2*t+1]=0):(c[2*t]=a*r/l,c[2*t+1]=a*-e/l)}const w=u;let M=0,m=1/0;for(let t=0;t<s;t++){const n=(t+1)%s,e=o[2*n]-o[2*t],r=o[2*n+1]-o[2*t+1],l=Math.sqrt(e*e+r*r);M+=l,m=Math.min(m,l)}const p=Math.abs(i),F=M>0?p/M:0,x=Math.min(.5*r,.25*F),d=m<r;for(let n=0;n<s;n++){const e=(n-1+s)%s,o=n,l=c[2*e],i=c[2*e+1],a=c[2*o],g=c[2*o+1],y=0==l&&0==i,w=0==a&&0==g;let M,m,p;if(y&&w)M=0,m=0,p=1;else if(y)M=a,m=g,p=1;else if(w)M=l,m=i,p=1;else{let t=l+a,n=i+g;const e=Math.sqrt(t*t+n*n);if(e<1e-10)M=l,m=i,p=1;else{t/=e,n/=e;const r=t*l+n*i;p=1/Math.max(r,.1),M=t,m=n}}const F=(d?0:x)*p,b=(d?r:x)*p,q=t[2*(A+n)],U=t[2*(A+n)+1];f[2*(A+n)]=q-M*F,f[2*(A+n)+1]=U-m*F,f[2*u]=q+M*b,f[2*u+1]=U+m*b,h[u]=0,u++}for(let t=0;t<s;t++){const n=(t+1)%s,e=A+t,r=A+n,o=w+t,l=w+n;g[y++]=e,g[y++]=r,g[y++]=l,g[y++]=e,g[y++]=l,g[y++]=o}A+=s}return{positions:f,edge_distance:h,indices:g,nvertices:a,ntriangles:c}
79},e.point_in_ring=s,e.classify_rings=function(t){const n=t.length;if(0==n)return[];const e=t.map(t=>Math.abs(l(t))),r=t.map(i),o=new Int32Array(n).fill(-1),c=Array.from({length:n},(t,n)=>n);c.sort((t,n)=>e[t]-e[n]);for(let l=0;l<n;l++){const i=c[l],f=t[i];if(!(f.length<2))for(let h=l+1;h<n;h++){const n=c[h];if(!(e[n]<=e[i])&&a(r[n],r[i])&&s(f[0],f[1],t[n])){o[i]=n;break}}}const f=new Int32Array(n).fill(-1),h=t=>{const n=f[t];if(n>=0)return n;const e=o[t];return f[t]=-1==e?0:h(e)+1},g=Array.from({length:n},()=>new Array);for(let t=0;t<n;t++){const n=o[t];-1!=n&&g[n].push(t)}const u=[];for(let e=0;e<n;e++){if(h(e)%2!=0)continue;const n=[t[e],...g[e].map(n=>t[n])];u.push({rings:n,flat_coords:n.flat()})}return u},e.build_line_from_ring=function(t){const n=t.length/2;if(n<2)return{points:new Float32Array(0),show:new Uint8Array(0),nline:0,length_so_far:new Float32Array(0)};const e=n>2&&t[0]==t[2*(n-1)]&&t[1]==t[2*(n-1)+1],r=e?n:n+1,o=new Float32Array(2*(r+2));for(let e=0;e<n;e++)o[2*(e+1)]=t[2*e],o[2*(e+1)+1]=t[2*e+1];e||(o[2*(n+1)]=t[0],o[2*(n+1)+1]=t[1]);e?(o[0]=o[2*(n-1)],o[1]=o[2*(n-1)+1],o[2*(r+1)]=o[4],o[2*(r+1)+1]=o[5]):(o[0]=o[2*n],o[1]=o[2*n+1],o[2*(r+1)]=o[4],o[2*(r+1)+1]=o[5]);const l=new Uint8Array(r+1);l.fill(1);const s=r-1,i=new Float32Array(s);let a=0;for(let t=0;t<s;t++)i[t]=a,1==l[t+1]?a+=Math.sqrt((o[2*t+4]-o[2*t+2])**2+(o[2*t+5]-o[2*t+3])**2):a=0;return{points:o,show:l,nline:r,length_so_far:i}},e.POLYGON_AA_WIDTH=.75}, 80674: function _(t,n,e,x,r){function i(t,n,e,x,r){let i;if(r===C(t,n,e,x)>0)for(let r=n;r<e;r+=x)i=q(r/x|0,t[r],t[r+1],i);else for(let r=e-x;r>=n;r-=x)i=q(r/x|0,t[r],t[r+1],i);return i&&g(i,i.next)&&(A(i),i=i.next),i}function o(t,n){if(!t)return t;n||(n=t);let e,x=t;do{if(e=!1,x.steiner||!g(x,x.next)&&0!==m(x.prev,x,x.next))x=x.next;else{if(A(x),x=n=x.prev,x===x.next)break;e=!0}}while(e||x!==n);return n}function u(t,n,e,x,r,i,p){if(!t)return;!p&&i&&function(t,n,e,x){let r=t;do{0===r.z&&(r.z=h(r.x,r.y,n,e,x)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let n,e=1;do{let x,r=t;t=null;let i=null;for(n=0;r;){n++;let o=r,u=0;for(let t=0;t<e&&(u++,o=o.nextZ,o);t++);let l=e;for(;u>0||l>0&&o;)0!==u&&(0===l||!o||r.z<=o.z)?(x=r,r=r.nextZ,u--):(x=o,o=o.nextZ,l--),i?i.nextZ=x:t=x,x.prevZ=i,i=x;r=o}i.nextZ=null,e*=2}while(n>1)}(r)}(t,x,r,i);let v=t;for(;t.prev!==t.next;){const s=t.prev,h=t.next;if(i?f(t,x,r,i):l(t))n.push(s.i,t.i,h.i),A(t),t=h.next,v=h.next;else if((t=h)===v){p?1===p?u(t=y(o(t),n),n,e,x,r,i,2):2===p&&c(t,n,e,x,r,i):u(o(t),n,e,x,r,i,1);break}}}function l(t){const n=t.prev,e=t,x=t.next;if(m(n,e,x)>=0)return!1;const r=n.x,i=e.x,o=x.x,u=n.y,l=e.y,f=x.y,y=Math.min(r,i,o),c=Math.min(u,l,f),p=Math.max(r,i,o),v=Math.max(u,l,f);let s=x.next;for(;s!==n;){if(s.x>=y&&s.x<=p&&s.y>=c&&s.y<=v&&M(r,u,i,l,o,f,s.x,s.y)&&m(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function f(t,n,e,x){const r=t.prev,i=t,o=t.next;if(m(r,i,o)>=0)return!1;const u=r.x,l=i.x,f=o.x,y=r.y,c=i.y,p=o.y,v=Math.min(u,l,f),s=Math.min(y,c,p),a=Math.max(u,l,f),Z=Math.max(y,c,p),d=h(v,s,n,e,x),g=h(a,Z,n,e,x);let w=t.prevZ,z=t.nextZ;for(;w&&w.z>=d&&z&&z.z<=g;){if(w.x>=v&&w.x<=a&&w.y>=s&&w.y<=Z&&w!==r&&w!==o&&M(u,y,l,c,f,p,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,z.x>=v&&z.x<=a&&z.y>=s&&z.y<=Z&&z!==r&&z!==o&&M(u,y,l,c,f,p,z.x,z.y)&&m(z.prev,z,z.next)>=0)return!1;z=z.nextZ}for(;w&&w.z>=d;){if(w.x>=v&&w.x<=a&&w.y>=s&&w.y<=Z&&w!==r&&w!==o&&M(u,y,l,c,f,p,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;z&&z.z<=g;){if(z.x>=v&&z.x<=a&&z.y>=s&&z.y<=Z&&z!==r&&z!==o&&M(u,y,l,c,f,p,z.x,z.y)&&m(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function y(t,n){let e=t;do{const x=e.prev,r=e.next.next;!g(x,r)&&w(x,e,e.next,r)&&k(x,r)&&k(r,x)&&(n.push(x.i,e.i,r.i),A(e),A(e.next),e=t=r),e=e.next}while(e!==t);return o(e)}function c(t,n,e,x,r,i){let l=t;do{let t=l.next.next;for(;t!==l.prev;){if(l.i!==t.i&&d(l,t)){let f=j(l,t);return l=o(l,l.next),f=o(f,f.next),u(l,n,e,x,r,i,0),void u(f,n,e,x,r,i,0)}t=t.next}l=l.next}while(l!==t)}function p(t,n){let e=t.x-n.x;if(0===e&&(e=t.y-n.y,0===e)){e=(t.next.y-t.y)/(t.next.x-t.x)-(n.next.y-n.y)/(n.next.x-n.x)}return e}function v(t,n){const e=function(t,n){let e=n;const x=t.x,r=t.y;let i,o=-1/0;
80if(g(t,e))return e;do{if(g(t,e.next))return e.next;if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){const t=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(t<=x&&t>o&&(o=t,i=e.x<e.next.x?e:e.next,t===x))return i}e=e.next}while(e!==n);if(!i)return null;const u=i,l=i.x,f=i.y;let y=1/0;e=i;do{if(x>=e.x&&e.x>=l&&x!==e.x&&Z(r<f?x:o,r,l,f,r<f?o:x,r,e.x,e.y)){const n=Math.abs(r-e.y)/(x-e.x);k(e,t)&&(n<y||n===y&&(e.x>i.x||e.x===i.x&&s(i,e)))&&(i=e,y=n)}e=e.next}while(e!==u);return i}(t,n);if(!e)return n;const x=j(e,t);return o(x,x.next),o(e,e.next)}function s(t,n){return m(t.prev,t,n.prev)<0&&m(n.next,t,t.next)<0}function h(t,n,e,x,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-x)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function a(t){let n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function Z(t,n,e,x,r,i,o,u){return(r-o)*(n-u)>=(t-o)*(i-u)&&(t-o)*(x-u)>=(e-o)*(n-u)&&(e-o)*(i-u)>=(r-o)*(x-u)}function M(t,n,e,x,r,i,o,u){return!(t===o&&n===u)&&Z(t,n,e,x,r,i,o,u)}function d(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){let e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&w(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(k(t,n)&&k(n,t)&&function(t,n){let e=t,x=!1;const r=(t.x+n.x)/2,i=(t.y+n.y)/2;do{e.y>i!=e.next.y>i&&e.next.y!==e.y&&r<(e.next.x-e.x)*(i-e.y)/(e.next.y-e.y)+e.x&&(x=!x),e=e.next}while(e!==t);return x}(t,n)&&(m(t.prev,t,n.prev)||m(t,n.prev,n))||g(t,n)&&m(t.prev,t,t.next)>0&&m(n.prev,n,n.next)>0)}function m(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function g(t,n){return t.x===n.x&&t.y===n.y}function w(t,n,e,x){const r=b(m(t,n,e)),i=b(m(t,n,x)),o=b(m(e,x,t)),u=b(m(e,x,n));return r!==i&&o!==u||(!(0!==r||!z(t,e,n))||(!(0!==i||!z(t,x,n))||(!(0!==o||!z(e,t,x))||!(0!==u||!z(e,n,x)))))}function z(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function b(t){return t>0?1:t<0?-1:0}function k(t,n){return m(t.prev,t,t.next)<0?m(t,n,t.next)>=0&&m(t,t.prev,n)>=0:m(t,n,t.prev)<0||m(t,t.next,n)<0}function j(t,n){const e=B(t.i,t.x,t.y),x=B(n.i,n.x,n.y),r=t.next,i=n.prev;return t.next=n,n.prev=t,e.next=r,r.prev=e,x.next=e,e.prev=x,i.next=x,x.prev=i,x}function q(t,n,e,x){const r=B(t,n,e);return x?(r.next=x.next,r.prev=x,x.next.prev=r,x.next=r):(r.prev=r,r.next=r),r}function A(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function B(t,n,e){return{i:t,x:n,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function C(t,n,e,x){let r=0;for(let i=n,o=e-x;i<e;i+=x)r+=(t[o]-t[i])*(t[i+1]+t[o+1]),o=i;return r}x(),e.default=function(t,n,e=2){const x=n&&n.length,r=x?n[0]*e:t.length;let o=i(t,0,r,e,!0);const l=[];if(!o||o.next===o.prev)return l;let f,y,c;x&&(o=function(t,n,e,x){const r=[];for(let e=0,o=n.length;e<o;e++){const u=i(t,n[e]*x,e<o-1?n[e+1]*x:t.length,x,!1);u===u.next&&(u.steiner=!0),r.push(a(u))}r.sort(p);for(let t=0;t<r.length;t++)e=v(r[t],e);return e}(t,n,o,e));if(t.length>80*e){f=t[0],y=t[1];let n=f,x=y;for(let i=e;i<r;i+=e){const e=t[i],r=t[i+1];e<f&&(f=e),r<y&&(y=r),e>n&&(n=e),r>x&&(x=r)}c=Math.max(n-f,x-y),c=0!==c?32767/c:0}return u(o,l,e,f,y,c,0),l},e.deviation=function(t,n,e,x){const r=n&&n.length,i=r?n[0]*e:t.length;let o=Math.abs(C(t,0,i,e));if(r)for(let x=0,r=n.length;x<r;x++){const i=n[x]*e,u=x<r-1?n[x+1]*e:t.length;o-=Math.abs(C(t,i,u,e))}let u=0;for(let n=0;n<x.length;n+=3){const r=x[n]*e,i=x[n+1]*e,o=x[n+2]*e;u+=Math.abs((t[r]-t[o])*(t[i+1]-t[r+1])-(t[r]-t[i])*(t[o+1]-t[r+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},e.flatten=function(t){const n=[],e=[],x=t[0][0].length;let r=0,i=0;for(const o of t){for(const t of o)for(let e=0;e<x;e++)n.push(t[e]);i&&(r+=i,e.push(r)),i=o.length}return{vertices:n,holes:e,dimensions:x}}}, 81675: function _(t,e,s,i,a){i();const l=t(1),r=t(659),h=t(660),n=t(100),o=t(643),p=t(673),c=l.__importDefault(t(674));class PatchesGL extends r.BaseGLGlyph{glyph;_positions;_edge_distance;_elements=null;
81_total_element_count=0;_pv_fill_color=new h.NormalizedUint8Buffer(this.regl_wrapper,4);_pv_hatch_patterns=new h.Uint8Buffer(this.regl_wrapper);_pv_hatch_scales=new h.Float32Buffer(this.regl_wrapper);_pv_hatch_weights=new h.Float32Buffer(this.regl_wrapper);_pv_hatch_rgba=new h.NormalizedUint8Buffer(this.regl_wrapper,4);_fill_color=new h.NormalizedUint8Buffer(this.regl_wrapper,4);_have_hatch=!1;_hatch_patterns=new h.Uint8Buffer(this.regl_wrapper);_hatch_scales=new h.Float32Buffer(this.regl_wrapper);_hatch_weights=new h.Float32Buffer(this.regl_wrapper);_hatch_rgba=new h.NormalizedUint8Buffer(this.regl_wrapper,4);_line_points_buf;_line_show_buf;_length_so_far_buf;_linewidth=new h.Float32Buffer(this.regl_wrapper);_line_color=new h.NormalizedUint8Buffer(this.regl_wrapper,4);_line_cap=new h.Uint8Buffer(this.regl_wrapper);_line_join=new h.Uint8Buffer(this.regl_wrapper);_is_dashed=!1;_dash_tex=[];_dash_tex_info;_dash_scale;_dash_offset;_draw_lw;_draw_lc;_draw_lcap;_draw_ljoin;_draw_dti;_draw_ds;_draw_do;_poly_data;_pv_dirty=!0;_topology;_elements_signature="";constructor(t,e){super(t,e),this.glyph=e}draw(t,e,s){const i=e.glglyph,a=this!==i&&this.data_changed;
81this.visuals_changed&&(this._set_visuals(),this.visuals_changed=!1,this._pv_dirty=!0);const l=i.data_changed;if((l||i.data_mapped)&&(i._set_data(l),i.data_changed=!1,i.data_mapped=!1,this._pv_dirty||=l||a),this!==i&&(this.data_changed||this.data_mapped)&&(this.data_changed=!1,this.data_mapped=!1,this._pv_dirty=!0),null==i._poly_data)return;const{width:r,height:n}=s,o=[r,n],c=i._poly_data;if(this._pv_dirty&&c.fill_nvertices.length>0){const t=c.fill_nvertices;(0,h.expand_to_per_vertex)(this._fill_color,this._pv_fill_color,t,4),this._have_hatch&&((0,h.expand_to_per_vertex)(this._hatch_patterns,this._pv_hatch_patterns,t,1),(0,h.expand_to_per_vertex)(this._hatch_scales,this._pv_hatch_scales,t,1),(0,h.expand_to_per_vertex)(this._hatch_weights,this._pv_hatch_weights,t,1),(0,h.expand_to_per_vertex)(this._hatch_rgba,this._pv_hatch_rgba,t,4)),this._pv_dirty=!1}if(this.glyph.visuals.fill.doit&&null!=i._elements&&i._total_element_count>0)for(const e of t){if(e>=c.fill_element_counts.length)continue;const t=c.fill_element_counts[e];if(0==t)continue;const a=c.fill_element_offsets[e];this._have_hatch?this.regl_wrapper.polygon_hatch()({scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:o,positions:i._positions,fill_color:this._pv_fill_color,edge_distance:i._edge_distance,elements:i._elements,count:t,offset:a,antialias:p.POLYGON_AA_WIDTH/s.pixel_ratio,hatch_pattern:this._pv_hatch_patterns,hatch_scale:this._pv_hatch_scales,hatch_weight:this._pv_hatch_weights,hatch_color:this._pv_hatch_rgba}):this.regl_wrapper.polygon()({scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:o,positions:i._positions,fill_color:this._pv_fill_color,edge_distance:i._edge_distance,elements:i._elements,count:t,offset:a,antialias:p.POLYGON_AA_WIDTH/s.pixel_ratio})}if(this.glyph.visuals.line.doit)for(const e of t){if(e>=c.line_rings.length)continue;const t=this._linewidth.extract_at(e,1,this._draw_lw??=new h.Float32Buffer(this.regl_wrapper)),i=this._line_color.extract_at(e,4,this._draw_lc??=new h.NormalizedUint8Buffer(this.regl_wrapper,4)),a=this._line_cap.extract_at(e,1,this._draw_lcap??=new h.Uint8Buffer(this.regl_wrapper)),l=this._line_join.extract_at(e,1,this._draw_ljoin??=new h.Uint8Buffer(this.regl_wrapper));let r,n,p;const f=Math.min(e,this._dash_tex.length-1);this._is_dashed&&null!=this._dash_tex[f]&&(r=this._dash_tex_info.extract_at(e,4,this._draw_dti??=new h.Float32Buffer(this.regl_wrapper,4)),n=this._dash_scale.extract_at(e,1,this._draw_ds??=new h.Float32Buffer(this.regl_wrapper)),p=this._dash_offset.extract_at(e,1,this._draw_do??=new h.Float32Buffer(this.regl_wrapper)));const d=c.line_rings[e];for(const e of d){if(e.nline<2)continue;const c=e.nline-1,[d,g]=this.regl_wrapper.framebuffer_and_texture;this.regl_wrapper.clear_framebuffer(d),null==this._line_points_buf&&(this._line_points_buf=new h.Float32Buffer(this.regl_wrapper));this._line_points_buf.get_sized_array(e.points.length).set(e.points),this._line_points_buf.update(),null==this._line_show_buf&&(this._line_show_buf=new h.Uint8Buffer(this.regl_wrapper));this._line_show_buf.get_sized_array(e.show.length).set(e.show),this._line_show_buf.update();const w={scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,canvas_size:o,antialias:1.5/s.pixel_ratio,miter_limit:10,points:this._line_points_buf,show:this._line_show_buf,nsegments:c,linewidth:t,line_color:i,line_cap:a,line_join:l,framebuffer:d,point_offset:0,line_offset:0};if(this._is_dashed&&null!=r){null==this._length_so_far_buf&&(this._length_so_far_buf=new h.Float32Buffer(this.regl_wrapper));this._length_so_far_buf.get_sized_array(e.length_so_far.length).set(e.length_so_far),this._length_so_far_buf.update();const t={...w,length_so_far:this._length_so_far_buf,dash_tex:this._dash_tex[f],dash_tex_info:r,dash_scale:n,dash_offset:p};this.regl_wrapper.dashed_line()(t)}else this.regl_wrapper.solid_line()(w);const u={scissor:this.regl_wrapper.scissor,viewport:this.regl_wrapper.viewport,framebuffer_tex:g};this.regl_wrapper.accumulate()(u)}}}_set_data(t=!0){const{sxs:e,sys:s}=this.glyph,i=this.glyph.data_size,a=t||null==this._topology||this._topology.length!=i;let l=a;a&&(this._topology=new Array(i).fill(null));const r=new Array(i),n=new Array(i),o=new Array(i),f=new Array(i),d=new Array(i),g=[];let w=0,u=0;for(let h=0;h<i;h++){const i=e.get(h),m=s.get(h),v=(0,p.split_rings)(i,m);if(d[h]=[],v.length>0){let t=this._topology[h];if(a||null==t||t.some(({ring_indices:t})=>t.some(t=>t>=v.length))){l=!0;t=(0,p.classify_rings)(v).map(({flat_coords:t,rings:e})=>{const s=e.map(t=>v.indexOf(t)),i=[];let a=0;for(let t=0;t<e.length;t++)t>0&&i.push(a),a+=e[t].length/2;return{ring_indices:s,tri_indices:(0,c.default)(t,i.length>0?i:void 0,2)}}),this._topology[h]=t}g.push(t.map(({tri_indices:t})=>t.length).join(","));const e=[];let s=0,i=0;for(const{ring_indices:a,tri_indices:l}of t){const t=a.map(t=>v[t]),r=t.flat(),h=(0,p.generate_skirt_geometry)(r,t,l,p.POLYGON_AA_WIDTH);e.push({geom:h,rings:t}),s+=h.nvertices,i+=h.indices.length}r[h]={groups:e,all_rings:v},n[h]=s,o[h]=u,f[h]=i,w+=2*s,u+=i}else g.push(""),t&&(this._topology[h]=null),r[h]=null,n[h]=0,o[h]=u,f[h]=0}const m=w/2;null==this._positions&&(this._positions=new h.Float32Buffer(this.regl_wrapper,2));const v=this._positions.get_sized_array(w);null==this._edge_distance&&(this._edge_distance=new h.Float32Buffer(this.regl_wrapper));const y=this._edge_distance.get_sized_array(m),x=g.join(";");l||=x!=this._elements_signature;const B=l||null==this._elements?new Uint32Array(u):null;let b=0,z=0,F=0,A=0;for(let t=0;t<i;t++){const e=r[t];if(null==e)continue;const{groups:s,all_rings:i}=e;for(const{geom:t}of s){if(v.set(t.positions,b),b+=t.positions.length,y.set(t.edge_distance,z),z+=t.edge_distance.length,null!=B)for(let e=0;e<t.indices.length;e++)B[F+e]=t.indices[e]+A;F+=t.indices.length,A+=t.nvertices}const a=[];for(const t of i){const e=(0,p.build_line_from_ring)(t);e.nline>0&&a.push(e)}d[t]=a}this._poly_data={line_rings:d,fill_nvertices:n,fill_element_offsets:o,fill_element_c
81ounts:f},this._positions.update(),this._edge_distance.update(),this._total_element_count=u,null!=B&&(this._elements?.destroy(),this._elements=u>0?this.regl_wrapper.elements({usage:"static",primitive:"triangles",data:B,type:"uint32"}):null),this._elements_signature=x}_set_visuals(){const t=this.glyph.visuals.fill;this._fill_color.set_from_color(t.fill_color,t.fill_alpha);const e=this.glyph.visuals.line;this._line_color.set_from_color(e.line_color,e.line_alpha),this._linewidth.set_from_prop(e.line_width),this._line_cap.set_from_line_cap(e.line_cap),this._line_join.set_from_line_join(e.line_join);const{line_dash:s}=e,i=s.is_Scalar()?1:s.length,a=new Array(i);this._is_dashed=!1;for(let t=0;t<i;t++){const e=(0,o.normalize_dash_pattern)((0,n.resolve_line_dash)(s.get(t)));a[t]=e,this._is_dashed||=0!=e.length}if(this._dash_tex=[],this._is_dashed){null==this._dash_offset&&(this._dash_offset=new h.Float32Buffer(this.regl_wrapper)),this._dash_offset.set_from_prop(e.line_dash_offset),null==this._dash_tex_info&&(this._dash_tex_info=new h.Float32Buffer(this.regl_wrapper,4));const t=this._dash_tex_info.get_sized_array(4*i);null==this._dash_scale&&(this._dash_scale=new h.Float32Buffer(this.regl_wrapper));const l=this._dash_scale.get_sized_array(i);for(let e=0;e<i;e++){const s=a[e];if(s.length>0){const[i,a,r]=this.regl_wrapper.get_dash(s);this._dash_tex.push(a);for(let s=0;s<4;s++)t[4*e+s]=i[s];l[e]=r}else this._dash_tex.push(null),t.fill(0,4*e,4*(e+1)),l[e]=0}const r=s.is_Scalar();this._dash_tex_info.update(r),this._dash_scale.update(r)}const l=this.glyph.visuals.hatch;this._have_hatch=l.doit,this._have_hatch&&(this._hatch_patterns.set_from_hatch_pattern(l.hatch_pattern),this._hatch_scales.set_from_prop(l.hatch_scale),this._hatch_weights.set_from_prop(l.hatch_weight),this._hatch_rgba.set_from_color(l.hatch_color,l.hatch_alpha))}}s.PatchesGL=PatchesGL}, 82676: function _(s,e,t,a,r){a();const i=s(658),h=s(661),l=s(21);class MultiMarkerGL extends i.BaseMarkerGL{glyph;_marker_types;_unique_marker_types;constructor(s,e){super(s,e),this.glyph=e}draw(s,e,t){const a=e.glglyph;(a.data_changed||a.data_mapped)&&(a.set_data(),a.data_changed=!1,a.data_mapped=!1),this.visual
82s_changed&&(this._set_visuals(),this.visuals_changed=!1);const r=a.nvertices,i=a._unique_marker_types.length;for(const e of a._unique_marker_types){if(null==e)continue;let h=r;const l=this._show.length,n=this._show.get_sized_array(r);if(i>1||s.length<r){this._show_all=!1,n.fill(0),h=0;for(let t=0;t<s.length;t++)1!=i&&a._marker_types.get(t)!=e||(n[s[t]]=255,h++)}else this._show_all&&l==r||(this._show_all=!0,n.fill(255));this._show.update(),0!=h&&this._draw_one_marker_type(e,t,a)}}_get_visuals(){return this.glyph.visuals}_set_data(){const s=this.nvertices,e=this._centers.get_sized_array(2*s);(0,h.interleave)(this.glyph.sx,this.glyph.sy,s,i.BaseMarkerGL.missing_point,e),this._centers.update(),this._widths.set_from_prop(this.glyph.size),this._angles.set_from_prop(this.glyph.angle),null==this._marker_types&&(this._marker_types=this.glyph.marker,this._unique_marker_types=this._marker_types.unique().filter(s=>l.MarkerType.valid(s)))}_set_once(){super._set_once(),this._heights.set_from_scalar(0),this._auxs.set_from_scalar(0)}}t.MultiMarkerGL=MultiMarkerGL}, 83677: function _(t,s,e,n,o){n();const r=t(665);class NgonGL extends r.RadialGL{glyph;constructor(t,s){super(t,s),this.glyph=s}get marker_type(){return"ngon"}_set_data(){super._set_data(),this._angles.set_from_prop(this.glyph.angle),this._auxs.set_from_prop(this.glyph.n)}}e.NgonGL=NgonGL}, 84678: function _(t,s,r,e,h){e();const o=t(656);class RectGL extends o.SXSYGlyphGL{glyph;constructor(t,s){super(t,s),this.glyph=s}get marker_type(){return this._border_radius_nonzero?"round_rect":"rect"}_set_data(){super._set_data(),this._widths.set_from_array(this.glyph.swidth),this._heights.set_from_array(this.glyph.sheight),this._angles.set_from_prop(this.glyph.angle);const{top_left:t,top_right:s,bottom_right:r,bottom_left:e}=this.glyph.border_radius;this._border_radius=[t,s,r,e],this._border_radius_nonzero=Math.max(...this._border_radius)>0}_set_once(){super._set_once(),this._auxs.set_from_scalar(0)}}r.RectGL=RectGL}, 85679: function _(e,t,s,i,h){i();const l=e(660),n=e(669),r=e(13);class StepGL extends n.SingleLineGL{glyph;constructor(e,t){super(e,t),this.glyph=t}draw(e,t,s){this._draw_impl(e,s,t.glglyph)}_get_show_buffer(e,t){const s=t._show;let i=s;const h=this.glyph.model.mode,n=s.length,{pad_before:r,pad_after:a}=this.glyph.model,o=n-1-((0!=r?1:0)+(0!=a?1:0)),p="center"==h?(o+2)/3:(o+1)/2;if(e.length!=p){const t=s.get_sized_array(n);null==this._show&&(this._show=new l.Uint8Buffer(this.regl_wrapper));const a=this._show.get_sized_array(n);a.fill(0);const o="center"==h?1:0,p=0!=r?1:0;if(e.length>1)for(let s=0;s<e.length;s++){const i=e[s],h=i*(2+o)+1+p;i==e[s+1]-1&&(a[h]=t[h],a[h+1]=t[h+1],a[h+1+o]=t[h+1+o])}this._show.update(),i=this._show}return i}_get_visuals(){return this.glyph.visuals.line}_set_data_points(){const e=this.glyph.sx,t=this.glyph.sy,s=this.glyph.model.mode,{pad_before:i,pad_after:h}=this.glyph.model,n=e.length,a=n>2&&e[0]==e[n-1]&&t[0]==t[n-1]&&isFinite(e[0])&&isFinite(t[0]),o=("center"==s?3*n-2:2*n-1)+(0!=i?1:0)+(0!=h?1:0);null==this._points&&(this._points=new l.Float32Buffer(this.regl_wrapper));const p=this._points.get_sized_array(2*(o+2));let c=2;if(0!=i){const e=this.glyph.renderer.xscale.s_compute(this.glyph.x[0]-i);p[c++]=e,p[c++]=t[0]}let g=isFinite(e[0]+t[0]);p[c++]=g?e[0]:NaN,p[c++]=t[0];for(let i=0;i<n-1;i++){const h=isFinite(e[i+1]+t[i+1]);switch(s){case"before":p[c++]=g&&h?e[i]:NaN,p[c++]=t[i+1],p[c++]=h?e[i+1]:NaN,p[c++]=t[i+1];break;case"after":p[c++]=g&&h?e[i+1]:NaN,p[c++]=t[i],p[c++]=h?e[i+1]:NaN,p[c++]=t[i+1];break;case"center":if(g&&h){const s=(e[i]+e[i+1])/2;p[c++]=s,p[c++]=t[i],p[c++]=s,p[c++]=t[i+1],p[c++]=e[i+1],p[c++]=t[i+1]}else p[c++]=g?e[i]:NaN,p[c++]=t[i],p[c++]=NaN,p[c++]=NaN,p[c++]=h?e[i+1]:NaN,p[c++]=t[i+1];break;default:(0,r.unreachable)()}g=h}if(0!=h){const e=this.glyph.renderer.xscale.s_compute(this.glyph.x[n-1]+h);p[c++]=e,p[c++]=t[n-1]}return(0,r.assert)(c==2*o+2),a?(p[0]=p[2*o-2],p[1]=p[2*o-1],p[2*o+2]=p[4],p[2*o+3]=p[5]):(p[0]=0,p[1]=0,p[2*o+2]=0,p[2*o+3]=0),this._points.update(),p}}s.StepGL=StepGL}, 86680: function _(t,e,s,r,a){r();const n=t(656);class WedgeGL extends n.SXSYGlyphGL{glyph;constructor(t,e){super(t,e),this.glyph=e}get marker_type(){return"wedge"}get radius(){return this._widths}get start_angle(){return this._angles}get end_angle(){return this._auxs}_set_data(){super._set_data(),this.radius.set_from_array(this.glyph.sradius),"anticlock"==this.glyph.model.direction?(this.start_angle.set_from_prop(this.glyph.start_angle),this.end_angle.set_from_prop(this.glyph.end_angle)):(this.start_angle.set_from_prop(this.glyph.end_angle),this.end_angle.set_from_prop(this.glyph.start_angle))}_set_once(){super._set_once(),this._heights.set_from_scalar(0)}}s.WedgeGL=WedgeGL}, 87}, 639, {"models/glyphs/webgl/main":639,"models/glyphs/webgl/index":640,"models/glyphs/webgl/regl_wrap":641,"models/glyphs/webgl/dash_cache":643,"models/glyphs/webgl/utils/math":644,"models/glyphs/webgl/accumulate.vert":645,"models/glyphs/webgl/accumulate.frag":646,"models/glyphs/webgl/image.vert":647,"models/glyphs/webgl/image.frag":648,"models/glyphs/webgl/regl_line.vert":649,"models/glyphs/webgl/regl_line.frag":650,"models/glyphs/webgl/marker.vert":651,"models/glyphs/webgl/marker.frag":652,"models/glyphs/webgl/polygon.vert":653,"models/glyphs/webgl/polygon.frag":654,"models/glyphs/webgl/annular_wedge":655,"models/glyphs/webgl/sxsy":656,"models/glyphs/webgl/single_marker":657,"models/glyphs/webgl/base_marker":658,"models/glyphs/webgl/base":659,"models/glyphs/webgl/buffer":660,"models/glyphs/webgl/webgl_utils":661,"models/glyphs/webgl/annulus":662,"models/glyphs/webgl/base_line":663,"models/glyphs/webgl/circle":664,"models/glyphs/webgl/radial":665,"models/glyphs/webgl/hex_tile":666,"models/glyphs/webgl/image":667,"models/glyphs/webgl/line_gl":668,"models/glyphs/webgl/single_line":669,"models/glyphs/webgl/lrtb":670,"models/glyphs/webgl/multi_line":671,"models/glyphs/webgl/patch":672,"core/util/polygon":673,"models/glyphs/webgl/patches":675,"models/glyphs/webgl/multi_marker":676,"models/glyphs/webgl/ngon":677,"models/glyphs/webgl/rect":678,"models/glyphs/webgl/step":679,"models/glyphs/webgl/wedge":680}, {});});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.