diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 57f402f..61f5260 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -11,7 +11,7 @@
"forwardPorts": [8000],
// Use 'postCreateCommand' to run commands after the container is created.
- "postCreateCommand": "pip install -r requirements.txt && wget -O SIMPLE.sqlite https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-binary/main/SIMPLE.sqlite && python -m simple_app.app_simple -d"
+ "postCreateCommand": "pip install -r requirements.txt && wget -O database.toml https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-db/refs/heads/main/database.toml && wget -O SIMPLE.sqlite https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-binary/main/SIMPLE.sqlite && python -m simple_app.app_simple -d"
// Configure tool-specific properties.
// "customizations": {},
diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml
index 766d64f..2aa45b2 100644
--- a/.github/workflows/python-app.yml
+++ b/.github/workflows/python-app.yml
@@ -22,8 +22,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+ if [ -f requirements.txt ]; then pip install -Ur requirements.txt; fi
wget -O SIMPLE.sqlite https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-binary/main/SIMPLE.sqlite
+ wget -O database.toml https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-db/refs/heads/main/database.toml
+ mkdir data
- name: Test with pytest
run: |
pytest -v simple_app/tests/test_plots.py
diff --git a/.gitignore b/.gitignore
index d190ab6..ca11866 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@
*.sqlite
*.fits
simple_app/tmp/user*
+*yaml
+*toml
# Pycharm stuff
.idea*
@@ -100,4 +102,4 @@ ENV/
# Misc
.DS_Store
.vs/
-.vscode/
\ No newline at end of file
+.vscode/
diff --git a/cronjob.sh b/cronjob.sh
new file mode 100644
index 0000000..b60fcf2
--- /dev/null
+++ b/cronjob.sh
@@ -0,0 +1,4 @@
+cd ~/ROOT
+wget -O SIMPLE.sqlite https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-binary/main/SIMPLE.sqlite
+wget -O database.toml https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-db/refs/heads/main/database.toml
+git pull
diff --git a/requirements.txt b/requirements.txt
index eefbb7a..716f600 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
astrodbkit==2.5
astropy==7.1.0
-bokeh==3.7.3
+bokeh==3.8.2
Flask==3.1.1
Flask-Cors==6.0.0
Flask-WTF==1.2.2
@@ -9,9 +9,9 @@ multiprocess==0.70.17
numpy==1.26.4
pandas==2.0.3
pytest==8.3.4
-requests==2.32.4
+requests==2.33.0
specutils==2.2.0
SQLAlchemy==2.0.38
tqdm==4.67.1
-Werkzeug==3.1.4
-WTForms==3.2.1
+Werkzeug==3.1.5
+WTForms==3.2.1
\ No newline at end of file
diff --git a/simple_app/app_simple.py b/simple_app/app_simple.py
index 8f336aa..518021b 100644
--- a/simple_app/app_simple.py
+++ b/simple_app/app_simple.py
@@ -170,12 +170,21 @@ def raw_query():
except (ResourceClosedError, OperationalError, IndexError, SqliteWarning, BadSQLError, ProgrammingError):
results = pd.DataFrame()
- results = reference_handle(results, db_file, True)
+ if 'access_url' in results.columns:
+ url_links = [f'Link' for url in results.access_url.values]
+ results.drop(columns=['access_url'], inplace=True)
+ download_col = 'download'
+ results.insert(1, download_col, url_links)
+
+ results = reference_handle(results, db_file)
+ res_len = len(results)
stringed_results = one_df_query(results)
- return render_template('raw_query.html', form=form, results=stringed_results, version_str=version_str)
+ return render_template('raw_query.html', form=form, results=stringed_results, query=query,
+ res_len=res_len, version_str=version_str)
else:
- return render_template('raw_query.html', form=form, results=None, query='', version_str=version_str)
+ return render_template('raw_query.html', form=form, results=None, res_len=0, query='',
+ version_str=version_str)
@app_simple.route('/solo_result/')
@@ -338,13 +347,8 @@ def create_spectra_files_for_download():
results: pd.DataFrame = getattr(everything, 'spectra')
# write all spectra for object to zipped file
- zipped = write_spec_files(results.access_url.values)
- if zipped is not None:
- response = Response(zipped, mimetype='application/zip')
- response = control_response(response, app_type='zip')
- return response
-
- abort(400, 'Could not download fits')
+ response = zip_spectra(results.access_url)
+ return response if response is not None else abort(400, 'Could not download fits')
@app_simple.route('/write_multi_spectra', methods=['GET'])
@@ -360,13 +364,27 @@ def create_multi_spectra_files_for_download():
spectra_df: pd.DataFrame = resultdict['Spectra']
# write all spectra for object to zipped file
- zipped = write_spec_files(spectra_df.access_url.values)
- if zipped is not None:
- response = Response(zipped, mimetype='application/zip')
- response = control_response(response, app_type='zip')
- return response
+ response = zip_spectra(spectra_df.access_url)
+ return response if response is not None else abort(400, 'Could not download fits')
+
+
+@app_simple.route('/write_sql_spectra', methods=['GET', 'POST'])
+def create_sql_spectra_files_for_download():
+ """
+ Downloads all spectra from a raw SQL query if an access_url column is present.
+ """
+ query = session.get('query')
+ db = SimpleDB(db_file)
+
+ # query database via sql
+ results: Optional[pd.DataFrame] = db.sql_query(query, fmt='pandas')
- abort(400, 'Could not download fits')
+ if 'access_url' not in results.columns:
+ abort(400, 'No url column in SQL results')
+
+ # write all spectra in SQL result to zipped file
+ response = zip_spectra(results.access_url)
+ return response if response is not None else abort(400, 'Could not download fits')
@app_simple.route('/write_filt', methods=['GET'])
@@ -474,6 +492,17 @@ def create_file_for_sql_download():
return response
+@app_simple.route('/download_sqlite', methods=['GET'])
+def download_sqlite():
+ """
+ Downloads the SIMPLE.db file.
+ """
+ local_db_file = db_file.replace('sqlite:///', '')
+ directory = os.path.dirname(local_db_file) or '..' # code runs in simple_app dir, we keep the binary one dir up
+ filename = os.path.basename(local_db_file)
+ return send_from_directory(directory, filename, as_attachment=True)
+
+
args, db_file, photometric_filters, all_results, all_results_full, version_str, \
all_photometry, all_bands, all_parallaxes, all_spectral_types = main_utils()
night_sky_theme, js_callbacks = main_plots()
diff --git a/simple_app/simports.py b/simple_app/simports.py
index b7b5368..eb9e3bc 100644
--- a/simple_app/simports.py
+++ b/simple_app/simports.py
@@ -12,7 +12,7 @@
from sqlite3 import Warning as SqliteWarning # errors from sqlite
from time import localtime, strftime # time stuff for naming files
from typing import Dict, Generator, List, Optional, Tuple, Union # type hinting (good in IDEs)
-from urllib.parse import quote # handling strings into url friendly form
+from urllib.parse import quote, unquote, urlparse # handling strings into url friendly form
from zipfile import ZipFile # zipping files together
import astropy.units as u # units
@@ -67,3 +67,7 @@
from tqdm import tqdm # progress bars
from werkzeug.exceptions import HTTPException # underlying http
from wtforms import StringField, SubmitField, TextAreaField, ValidationError # web forms
+import tomllib
+with open("database.toml", "rb") as f:
+ settings = tomllib.load(f)
+ REFERENCE_TABLES = settings['lookup_tables']
diff --git a/simple_app/static/js/bokeh-3.7.3.min.js b/simple_app/static/js/bokeh-3.8.2.min.js
similarity index 51%
rename from simple_app/static/js/bokeh-3.7.3.min.js
rename to simple_app/static/js/bokeh-3.8.2.min.js
index 1c429d7..1aa8375 100644
--- a/simple_app/static/js/bokeh-3.7.3.min.js
+++ b/simple_app/static/js/bokeh-3.8.2.min.js
@@ -157,14 +157,14 @@
return main;
})
([
-function _(t,_,n,o,r){o();t(1).__exportStar(t(2),n),t(76)},
+function _(t,_,n,o,r){o();t(1).__exportStar(t(2),n),t(91)},
function _(e,t,r,n,o){n(),r.__extends=i,r.__rest=c,r.__decorate=s,r.__param=u,r.__esDecorate=f,r.__runInitializers=l,r.__propKey=p,r.__setFunctionName=_,r.__metadata=y,r.__awaiter=d,r.__generator=h,r.__exportStar=v,r.__values=b,r.__read=w,r.__spread=m,r.__spreadArrays=g,r.__spreadArray=O,r.__await=j,r.__asyncGenerator=P,r.__asyncDelegator=S,r.__asyncValues=E,r.__makeTemplateObject=x,r.__importStar=D,r.__importDefault=R,r.__classPrivateFieldGet=k,r.__classPrivateFieldSet=A,r.__classPrivateFieldIn=F,r.__addDisposableResource=C,r.__disposeResources=G,r.__rewriteRelativeImportExtension=z;var a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},a(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function u(e,t){return function(r,n){t(r,n,e)}}function f(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,s=n.kind,u="getter"===s?"get":"setter"===s?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,_=r.length-1;_>=0;_--){var y={};for(var d in n)y[d]="access"===d?{}:n[d];for(var d in n.access)y.access[d]=n.access[d];y.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[_])("accessor"===s?{get:l.get,set:l.set}:l[u],y);if("accessor"===s){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===s?o.unshift(c):l[u]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function l(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function m(){for(var e=[],t=0;t1||c(e,t)}))},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof j?Promise.resolve(r.value.v).then(s,u):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function s(e){c("next",e)}function u(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function S(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:j(e[n](t)),done:!1}:o?o(t):t}:o}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=b(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}r.__assign=function(){return r.__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r{(0,b.assert)(e instanceof S.ModelEvent),this.event_manager.trigger(e)}))}[p.equals](e,t){return this==e}get all_models(){return new Set(this._all_models.values())}get is_idle(){for(const e of this._roots)if(!this._idle_roots.has(e))return!1;return!0}notify_idle(e){this._idle_roots.add(e),this.is_idle&&(r.logger.info(`document idle at ${Date.now()-this._init_timestamp} ms`),this.event_manager.send_event(new E.DocumentReady),this.idle.emit())}clear(){this._push_all_models_freeze();try{for(;this._roots.length>0;)this.remove_root(this._roots[0])}finally{this._pop_all_models_freeze()}}interactive_start(e,t=null){null==this._interactive_plot&&(this._interactive_plot=e,this._interactive_plot.trigger_event(new E.LODStart)),this._interactive_finalize=t,this._interactive_timestamp=Date.now()}interactive_stop(){null!=this._interactive_plot&&(this._interactive_plot.trigger_event(new E.LODEnd),null!=this._interactive_finalize&&this._interactive_finalize()),this._interactive_plot=null,this._interactive_timestamp=null,this._interactive_finalize=null}interactive_duration(){return null==this._interactive_timestamp?-1:Date.now()-this._interactive_timestamp}destructively_move(e){if(e===this)throw new Error("Attempted to overwrite a document with itself");e.clear();const t=(0,g.copy)(this._roots);this.clear();for(const e of t)if(null!=e.document)throw new Error(`Somehow we didn't detach ${e}`);if(0!=this._all_models.size)throw new Error(`this._all_models still had stuff in it: ${this._all_models}`);for(const s of t)e.add_root(s);e.set_title(this._title)}_push_all_models_freeze(){this._hold_models_freeze||(this._all_models_freeze_count+=1)}_pop_all_models_freeze(){this._hold_models_freeze||(this._all_models_freeze_count-=1,0===this._all_models_freeze_count&&this._recompute_all_models())}_cancel_recompute_all_models(){null!=this._recompute_timer&&(clearTimeout(this._recompute_timer),this._recompute_timer=null)}_schedule_recompute_all_models(){const e=this._recompute_timeout;isNaN(e)||e<=0?this._recompute_all_models():isFinite(e)&&(this._cancel_recompute_all_models(),this._recompute_timer=setTimeout((()=>{this._recompute_all_models()}),e))}_recompute_all_models(){this._cancel_recompute_all_models();let e=new Set;for(const t of this._roots)e=w.union(e,t.references());const t=new Set(this._all_models.values()),s=w.difference(t,e),o=w.difference(e,t),_=new Map;for(const t of e)_.set(t.id,t);for(const e of s)e.detach_document();for(const e of o)e.attach_document(this),this._new_models.add(e);this._all_models=_}partially_update_all_models(e){const t=new Set;a.HasProps._value_record_references(e,t,{recursive:!1});for(const e of t)this._all_models.has(e.id)||(e.attach_document(this),this._new_models.add(e),this._all_models.set(e.id,e));this._schedule_recompute_all_models()}roots(){return this._roots}_add_roots(...e){if(0==(e=e.filter((e=>!this._roots.includes(e)))).length)return!1;this._push_all_models_freeze();try{this._roots.push(...e)}finally{this._pop_all_models_freeze()}return!0}_remove_root(e){const t=this._roots.indexOf(e);if(t<0)return!1;this._push_all_models_freeze();try{this._roots.splice(t,1)}finally{this._pop_all_models_freeze()}return!0}_set_title(e){const t=e!=this._title;return t&&(this._title=e),t}add_root(e,{sync:t}={}){if(this._add_roots(e)){const s=new D.RootAddedEvent(this,e);s.sync=t??!0,this._trigger_on_change(s)}}remove_root(e,{sync:t}={}){if(this._remove_root(e)){const s=new D.RootRemovedEvent(this,e);s.sync=t??!0,this._trigger_on_change(s)}}set_title(e,{sync:t}={}){if(this._set_title(e)){const s=new D.TitleChangedEvent(this,e);s.sync=t??!0,this._trigger_on_change(s)}}title(){return this._title}get_model_by_id(e){return this._all_models.get(e)??null}get_model_by_name(e){const t=[];for(const s of this._all_models.values())s instanceof k.Model&&s.name==e&&t.push(s);switch(t.length){case 0:return null;case 1:return t[0];default:throw new Error(`Multiple models are named '${e}'`)}}on_message(e,t){const s=this._message_callbacks.get(e);null==s?this._message_callbacks.set(e,new Set([t])):s.add(t)}remove_on_message(e,t){this._message_callbacks.get(e)?.delete(t)}_trigger_on_message(e,t){const s=this._message_callbacks.get(e);if(null!=s)for(const e of s)e(t)}on_change(e,t=!1){this._callbacks.has(e)||this._callbacks.set(e,t)}remove_on_change(e){this._callbacks.delete(e)}_trigger_on_change(e){for(const[t,s]of this._callbacks)if(!s&&e instanceof D.DocumentEventBatch)for(const s of e.events)t(s);else t(e)}_trigger_on_event(e){const t=this._document_callbacks.get(e.event_name);if(null!=t)for(const s of t)(0,y.execute)(s,this,e)}on_event(e,...t){const s=(0,f.isString)(e)?e:e.prototype.event_name,o=this._document_callbacks.get(s)??[],_=t;this._document_callbacks.set(s,[...o,..._])}to_json_string(e=!0){return JSON.stringify(this.to_json(e))}to_json(e=!0){const t=new h.Serializer({include_defaults:e}).encode(this._roots);return{version:l.version,title:this._title,roots:t}}static from_json_string(e,t){const s=JSON.parse(e);return j.from_json(s,t)}static _handle_version(e){null==e.version&&r.logger.warn("'version' field is missing");const t=e.version??"0.0.0",s=m.Version.from(t),o=m.Version.from(l.version),_=`new document using Bokeh ${t} and BokehJS ${l.version}`;(0,p.is_equal)(s,o)?r.logger.debug(_):r.logger.warn(`Bokeh/BokehJS version mismatch: ${_}`)}static from_json(e,t){r.logger.debug("Creating Document from JSON"),j._handle_version(e);const s=new c.ModelResolver(i.default_resolver);if(null!=e.defs){new d.Deserializer(s).decode(e.defs)}const o=new j({resolver:s});o._push_all_models_freeze();const _=e=>t?.push(e);o.on_change(_,!0);const n=new d.Deserializer(s,o._all_models,(e=>e.attach_document(o))),l=n.decode(e.roots),a=null!=e.callbacks?n.decode(e.callbacks):{};o.remove_on_change(_);for(const[e,t]of(0,v.entries)(a))o.on_event(e,...t);for(const e of l)o.add_root(e);return null!=e.title&&o.set_title(e.title),o._pop_all_models_freeze(),o}replace_with_json(e){j.from_json(e).destructively_move(this)}create_json_patch(e){for(const t of e)if(t.document!=this)throw new Error("Cannot create a patch using events from a different document");const t=new Map;for(const e of this._all_models.values())this._new_models.has(e)||t.set(e,e.ref());const s={events:new h.Serializer({references:t,binary:!0}).encode(e)};return this._new_models.clear(),s}apply_json_patch(e,t=new Map){const{_hold_models_freeze:s}=this;this._hold_models_freeze=!0;try{this._apply_json_patch(e,t)}finally{this._hold_models_freeze=s}this._schedule_recompute_all_models()}_apply_json_patch(e,t=new Map){const s=new d.Deserializer(this._resolver,this._all_models,(e=>{e.attach_document(this),this._new_models.add(e),this._all_models.set(e.id,e)})).decode(e.events,t);for(const e of s)switch(e.kind){case"MessageSent":{const{msg_type:t,msg_data:s}=e;this._trigger_on_message(t,s);break}case"ModelChanged":{const{model:t,attr:s,new:o}=e;t.setv({[s]:o},{sync:!1});break}case"ColumnDataChanged":{const{model:t,attr:s,data:o,cols:_}=e;if(null!=_){const e=(0,v.dict)(o),_=(0,v.dict)(t.property(s).get_value());for(const[t,s]of _)e.has(t)||e.set(t,s)}t.setv({data:o},{sync:!1,check_eq:!1});break}case"ColumnsStreamed":{const{model:t,attr:s,data:o,rollover:_}=e,n=t.property(s);t.stream_to(n,o,_,{sync:!1});break}case"ColumnsPatched":{const{model:t,attr:s,patches:o}=e,_=t.property(s);t.patch_to(_,o,{sync:!1});break}case"RootAdded":this.add_root(e.model,{sync:!1});break;case"RootRemoved":this.remove_root(e.model,{sync:!1});break;case"TitleChanged":this.set_title(e.title,{sync:!1});break;default:throw new Error(`unknown patch event type '${e.kind}'`)}}}s.Document=j,j.__name__="Document"},
-function _(e,r,t,n,s){n(),t.register_models=function(e,r=!1){for(const s of(0,l.isArray)(e)?e:(0,o.values)(e))n=s,(0,l.isObject)(n)&&n.prototype instanceof u.HasProps&&t.default_resolver.register(s,r);var n};const l=e(8),o=e(9),i=e(8),u=e(15),f=e(46);t.default_resolver=new f.ModelResolver(null),t.Models=new Proxy(t.default_resolver,{get(e,r,t){if((0,i.isString)(r)){const t=e.get(r);if(null!=t)return t}return Reflect.get(e,r,t)},has(e,r){if((0,i.isString)(r)){if(null!=e.get(r))return!0}return Reflect.has(e,r)},ownKeys:e=>e.names,getOwnPropertyDescriptor(e,r){if((0,i.isString)(r)){const t=e.get(r);if(null!=t)return{configurable:!0,enumerable:!0,writable:!1,value:t}}return Reflect.getOwnPropertyDescriptor(e,r)}})},
+function _(e,o,s,t,l){t();const n=e(1);l("version",e(3).version),l("index",e(4).index),s.embed=n.__importStar(e(4)),s.protocol=n.__importStar(e(89));var r=e(20);l("logger",r.logger),l("set_log_level",r.set_log_level),l("settings",e(30).settings),l("Models",e(7).Models),l("documents",e(5).documents),l("safely",e(90).safely)},
+function _(n,i,o,c,e){c(),o.version="3.8.2"},
+function _(e,o,t,n,r){n(),t.embed_item=async function(e,o){const t={},n=(0,_.uuid4)();t[n]=e.doc,null==o&&(o=e.target_id);const r={roots:{[e.root_id]:o},root_ids:[e.root_id],docid:n};await(0,u.defer)();const[s]=await k(t,[r]);return s},t.embed_items=async function(e,o,t,n){return await(0,u.defer)(),k(e,o,t,n)};const s=e(5),d=e(30),i=e(20),_=e(41),c=e(9),a=e(8),u=e(17),l=e(81),m=e(82),f=e(87);var w=e(81);r("add_document_standalone",w.add_document_standalone),r("index",w.index),r("add_document_from_session",e(82).add_document_from_session);var g=e(88);async function k(e,o,t,n){(0,a.isString)(e)&&(e=JSON.parse((0,_.unescape)(e)));const r={};for(const[o,t]of(0,c.entries)(e))r[o]=s.Document.from_json(t);const u=[];for(const e of o){const o=(0,f._resolve_element)(e),s=(0,f._resolve_root_elements)(e);if(null!=e.docid)u.push(await(0,l.add_document_standalone)(r[e.docid],o,s,e.use_for_title));else{if(null==e.token)throw new Error("Error rendering Bokeh items: either 'docid' or 'token' was expected.");{const r=(0,m._get_ws_url)(t,n);i.logger.debug(`embed: computed ws url: ${r}`);try{u.push(await(0,m.add_document_from_session)(r,e.token,o,s,e.use_for_title)),console.log("Bokeh items were rendered successfully")}catch(e){if(d.settings.dev)throw e;console.error("Error rendering Bokeh items:",e)}}}}return u}r("embed_items_notebook",g.embed_items_notebook),r("kernels",g.kernels)},
+function _(t,r,_,o,e){o();const n=t(1);n.__exportStar(t(6),_),n.__exportStar(t(42),_);const s=t(7),a=n.__importStar(t(53));(0,s.register_models)(a)},
+function _(e,t,s,o,i){o();const _=e(1),n=e(7),l=e(3),r=e(20),a=e(15),c=e(47),h=e(33),d=e(48),m=e(50),u=e(16),f=e(8),g=e(27),p=e(10),v=e(9),w=_.__importStar(e(45)),y=e(51),b=e(12),k=e(52),z=e(53),S=e(79),D=e(80),E=e(80),M=e(42);d.Deserializer.register("model",S.decode_def);class j{constructor(e){this.subscribed_models=new Set,this.document=e}send_event(e){if(e.publish){const t=new M.MessageSentEvent(this.document,"bokeh_event",e);this.document._trigger_on_change(t)}this.document._trigger_on_event(e)}trigger(e){for(const t of this.subscribed_models)null!=e.origin&&e.origin!=t||t._process_event(e)}}s.EventManager=j,j.__name__="EventManager",s.documents=[],s.DEFAULT_TITLE="Bokeh Application";class C{get config(){return(0,b.assert)(null!=this._config,"configuration is missing"),this._config}set config(e){this.freeze_all_models((()=>this._config=e))}constructor(e={}){this._notified_idle=!1,this._hold_models_freeze=!1,this._recompute_timer=null,s.documents.push(this),this._init_timestamp=Date.now(),this._resolver=e.resolver??new c.ModelResolver(n.default_resolver),this._title=s.DEFAULT_TITLE,this._roots=[],this._all_models=new Map,this._new_models=new Set,this._all_models_freeze_count=0,this._callbacks=new Map,this._document_callbacks=new Map,this._message_callbacks=new Map,this.event_manager=new j(this),this.idle=new u.Signal0(this,"idle"),this._idle_roots=new WeakSet,this._interactive_timestamp=null,this._interactive_plot=null,this._recompute_timeout=e.recompute_timeout??3e4,null!=e.roots&&this._add_roots(...e.roots),this.on_message("bokeh_event",(e=>{(0,b.assert)(e instanceof D.ModelEvent),this.event_manager.trigger(e)})),this.config=new z.DocumentConfig}[g.equals](e,t){return this==e}get all_models(){return new Set(this._all_models.values())}get is_idle(){for(const e of this.roots())if(!this._idle_roots.has(e))return!1;return!0}notify_idle(e){!this._notified_idle&&this.roots().includes(e)&&(this._idle_roots.add(e),this.is_idle&&(r.logger.info(`document idle at ${Date.now()-this._init_timestamp} ms`),this.event_manager.send_event(new E.DocumentReady),this.idle.emit(),this._notified_idle=!0))}clear({sync:e}={}){this._push_all_models_freeze();try{for(;this._roots.length>0;)this.remove_root(this._roots[0],{sync:e});this._config=void 0}finally{this._pop_all_models_freeze()}}interactive_start(e,t=null){null==this._interactive_plot&&(this._interactive_plot=e,this._interactive_plot.trigger_event(new E.LODStart)),this._interactive_finalize=t,this._interactive_timestamp=Date.now()}interactive_stop(){null!=this._interactive_plot&&(this._interactive_plot.trigger_event(new E.LODEnd),null!=this._interactive_finalize&&this._interactive_finalize()),this._interactive_plot=null,this._interactive_timestamp=null,this._interactive_finalize=null}interactive_duration(){return null==this._interactive_timestamp?-1:Date.now()-this._interactive_timestamp}destructively_move(e){if(e===this)throw new Error("Attempted to overwrite a document with itself");e.clear({sync:!1});const{config:t}=this,s=(0,p.copy)(this._roots);this.clear({sync:!1});for(const e of[...s,t])if(null!=e.document)throw new Error(`Somehow we didn't detach ${e}`);if(0!=this._all_models.size)throw new Error(`this._all_models still had stuff in it: ${this._all_models}`);e.config=t;for(const t of s)e.add_root(t);e.set_title(this._title)}freeze_all_models(e){this._push_all_models_freeze();try{e()}finally{this._pop_all_models_freeze()}}_push_all_models_freeze(){this._hold_models_freeze||(this._all_models_freeze_count+=1)}_pop_all_models_freeze(){this._hold_models_freeze||(this._all_models_freeze_count-=1,0===this._all_models_freeze_count&&this._recompute_all_models())}_cancel_recompute_all_models(){null!=this._recompute_timer&&(clearTimeout(this._recompute_timer),this._recompute_timer=null)}_schedule_recompute_all_models(){const e=this._recompute_timeout;isNaN(e)||e<=0?this._recompute_all_models():isFinite(e)&&(this._cancel_recompute_all_models(),this._recompute_timer=setTimeout((()=>{this._recompute_all_models()}),e))}_recompute_all_models(){this._cancel_recompute_all_models();let e=new Set;for(const t of this.all_roots)e=w.union(e,t.references());const t=new Set(this._all_models.values()),s=w.difference(t,e),o=w.difference(e,t),i=new Map;for(const t of e)i.set(t.id,t);for(const e of s)e.detach_document();for(const e of o)e.attach_document(this),this._new_models.add(e);this._all_models=i}partially_update_all_models(e){const t=new Set;a.HasProps._value_record_references(e,t,{recursive:!1});for(const e of t)this._all_models.has(e.id)||(e.attach_document(this),this._new_models.add(e),this._all_models.set(e.id,e));this._schedule_recompute_all_models()}get all_roots(){const e=[...this._roots];return null!=this._config&&e.push(this._config),e}roots(){return this._roots}_add_roots(...e){if(0==(e=e.filter((e=>!this._roots.includes(e)))).length)return!1;this._push_all_models_freeze();try{this._roots.push(...e)}finally{this._pop_all_models_freeze()}return!0}_remove_root(e){const t=this._roots.indexOf(e);if(t<0)return!1;this._push_all_models_freeze();try{this._roots.splice(t,1)}finally{this._pop_all_models_freeze()}return!0}_set_title(e){const t=e!=this._title;return t&&(this._title=e),t}add_root(e,{sync:t}={}){if(this._add_roots(e)){const s=new M.RootAddedEvent(this,e);s.sync=t??!0,this._trigger_on_change(s)}}remove_root(e,{sync:t}={}){if(this._remove_root(e)){const s=new M.RootRemovedEvent(this,e);s.sync=t??!0,this._trigger_on_change(s)}}set_title(e,{sync:t}={}){if(this._set_title(e)){const s=new M.TitleChangedEvent(this,e);s.sync=t??!0,this._trigger_on_change(s)}}title(){return this._title}get_model_by_id(e){return this._all_models.get(e)??null}get_model_by_name(e){const t=[];for(const s of this._all_models.values())s instanceof k.Model&&s.name==e&&t.push(s);switch(t.length){case 0:return null;case 1:return t[0];default:throw new Error(`Multiple models are named '${e}'`)}}on_message(e,t){const s=this._message_callbacks.get(e);null==s?this._message_callbacks.set(e,new Set([t])):s.add(t)}remove_on_message(e,t){this._message_callbacks.get(e)?.delete(t)}_trigger_on_message(e,t){const s=this._message_callbacks.get(e);if(null!=s)for(const e of s)e(t)}on_change(e,t=!1){this._callbacks.has(e)||this._callbacks.set(e,t)}remove_on_change(e){this._callbacks.delete(e)}_trigger_on_change(e){for(const[t,s]of this._callbacks)if(!s&&e instanceof M.DocumentEventBatch)for(const s of e.events)t(s);else t(e)}_trigger_on_event(e){const t=this._document_callbacks.get(e.event_name);if(null!=t)for(const s of t)(0,y.execute)(s,this,e)}on_event(e,...t){const s=(0,f.isString)(e)?e:e.prototype.event_name,o=this._document_callbacks.get(s)??[],i=t;this._document_callbacks.set(s,[...o,...i])}to_json_string(e=!0){return JSON.stringify(this.to_json(e))}to_json(e=!0){const t=new h.Serializer({include_defaults:e}),s=t.encode(this.config),o=t.encode(this._roots);return{version:l.version,title:this._title,config:s,roots:o}}static from_json_string(e,t){const s=JSON.parse(e);return C.from_json(s,t)}static _handle_version(e){null==e.version&&r.logger.warn("'version' field is missing");const t=e.version??"0.0.0",s=m.Version.from(t),o=m.Version.from(l.version),i=`new document using Bokeh ${t} and BokehJS ${l.version}`;(0,g.is_equal)(s,o)?r.logger.debug(i):r.logger.warn(`Bokeh/BokehJS version mismatch: ${i}`)}static from_json(e,t){r.logger.debug("Creating Document from JSON"),C._handle_version(e);const s=new c.ModelResolver(n.default_resolver);if(null!=e.defs){new d.Deserializer(s).decode(e.defs)}const o=new C({resolver:s});o._push_all_models_freeze();const i=e=>t?.push(e);o.on_change(i,!0);const _=new d.Deserializer(s,o._all_models,(e=>e.attach_document(o))),l=_.decode(e.config);(0,b.assert)(l instanceof z.DocumentConfig||null==l),null!=l&&(o.config=l);const a=_.decode(e.roots),h=null!=e.callbacks?_.decode(e.callbacks):{};o.remove_on_change(i);for(const[e,t]of(0,v.entries)(h))o.on_event(e,...t);for(const e of a)o.add_root(e);return null!=e.title&&o.set_title(e.title),o._pop_all_models_freeze(),o}replace_with_json(e){C.from_json(e).destructively_move(this)}create_json_patch(e){for(const t of e)if(t.document!=this)throw new Error("Cannot create a patch using events from a different document");const t=new Map;for(const e of this._all_models.values())this._new_models.has(e)||t.set(e,e.ref());const s={events:new h.Serializer({references:t,binary:!0}).encode(e)};return this._new_models.clear(),s}apply_json_patch(e,t=new Map){const{_hold_models_freeze:s}=this;this._hold_models_freeze=!0;try{this._apply_json_patch(e,t)}finally{this._hold_models_freeze=s}this._schedule_recompute_all_models()}_apply_json_patch(e,t=new Map){const s=new d.Deserializer(this._resolver,this._all_models,(e=>{e.attach_document(this),this._new_models.add(e),this._all_models.set(e.id,e)})).decode(e.events,t);for(const e of s)switch(e.kind){case"MessageSent":{const{msg_type:t,msg_data:s}=e;this._trigger_on_message(t,s);break}case"ModelChanged":{const{model:t,attr:s,new:o}=e;t.setv({[s]:o},{sync:!1});break}case"ColumnDataChanged":{const{model:t,attr:s,data:o,cols:i}=e;if(null!=i){const e=(0,v.dict)(o),i=(0,v.dict)(t.property(s).get_value());for(const[t,s]of i)e.has(t)||e.set(t,s)}t.setv({data:o},{sync:!1,check_eq:!1});break}case"ColumnsStreamed":{const{model:t,attr:s,data:o,rollover:i}=e,_=t.property(s);t.stream_to(_,o,i,{sync:!1});break}case"ColumnsPatched":{const{model:t,attr:s,patches:o}=e,i=t.property(s);t.patch_to(i,o,{sync:!1});break}case"RootAdded":this.add_root(e.model,{sync:!1});break;case"RootRemoved":this.remove_root(e.model,{sync:!1});break;case"TitleChanged":this.set_title(e.title,{sync:!1});break;default:throw new Error(`unknown patch event type '${e.kind}'`)}}}s.Document=C,C.__name__="Document"},
+function _(e,r,t,n,s){n(),t.register_models=function(e,r=!1){for(const s of(0,l.isArray)(e)?e:(0,o.values)(e))n=s,(0,l.isObject)(n)&&n.prototype instanceof u.HasProps&&t.default_resolver.register(s,r);var n};const l=e(8),o=e(9),i=e(8),u=e(15),f=e(47);t.default_resolver=new f.ModelResolver(null),t.Models=new Proxy(t.default_resolver,{get(e,r,t){if((0,i.isString)(r)){const t=e.get(r);if(null!=t)return t}return Reflect.get(e,r,t)},has(e,r){if((0,i.isString)(r)){if(null!=e.get(r))return!0}return Reflect.has(e,r)},ownKeys:e=>e.names,getOwnPropertyDescriptor(e,r){if((0,i.isString)(r)){const t=e.get(r);if(null!=t)return{configurable:!0,enumerable:!0,writable:!1,value:t}}return Reflect.getOwnPropertyDescriptor(e,r)}})},
function _(n,r,t,e,i){e(),t.is_undefined=function(n){return void 0===n},t.is_defined=function(n){return void 0!==n},t.is_nullish=u,t.isBoolean=c,t.isNumber=f,t.isInteger=function(n){return f(n)&&Number.isInteger(n)},t.isString=s,t.isSymbol=a,t.isPrimitive=function(n){return null===n||c(n)||f(n)||s(n)||a(n)},t.isFunction=function(n){switch(o.call(n)){case"[object Function]":case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":return!0;default:return!1}},t.isArray=l,t.isArrayOf=function(n,r){if(!l(n))return!1;for(const t of n)if(!r(t))return!1;return!0},t.isArrayableOf=function(n,r){if(!j(n))return!1;for(const t of n)if(!r(t))return!1;return!0},t.isTypedArray=function(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)},t.isObject=b,t.isBasicObject=function(n){return b(n)&&u(n.constructor)},t.isPlainObject=y,t.isDict=function(n){return n instanceof Map||y(n)},t.isIterable=A,t.isArrayable=j,t.is_ArrayBufferLike=function(n){return n instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&n instanceof SharedArrayBuffer};
// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
@@ -177,239 +177,252 @@ const c=n(11),i=n(12),s=n(8),u=n(13);var f=n(13);o("map",f.map),o("reduce",f.red
function _(n,t,r,o,e){o(),r.angle_norm=s,r.angle_dist=h,r.angle_between=function(n,t,r,o=!1){const e=h(t,r);if(0==e)return!1;if(e==2*u)return!0;const a=s(n),c=h(t,a)<=e&&h(a,r)<=e;return o?!c:c},r.randomIn=function(n,t){null==t&&(t=n,n=0);return n+Math.floor(Math.random()*(t-n+1))},r.atan2=function(n,t){return Math.atan2(t[1]-n[1],t[0]-n[0])},r.radians=function(n){return n*(u/180)},r.degrees=function(n){return n/(u/180)},r.compute_angle=g,r.invert_angle=function(n,t,r="anticlock"){const o="anticlock"==r?1:-1;return-o*n/m(t)},r.to_radians_coeff=m,r.minmax=function(n,t){return n<=t?[n,t]:[t,n]},r.clamp=function(n,t,r){return nr?r:n},r.cycle=function(n,t,r){if(n>r)return t;if(n=0;a--)o+=e*n[a],e*=t;return o};const a=n(8),c=n(12),{PI:u,abs:i,sign:f,sqrt:l}=Math;function s(n){if(0==n)return 0;for(;n<=0;)n+=2*u;for(;n>2*u;)n-=2*u;return n}function h(n,t){return s(n-t)}function g(n,t,r="anticlock"){return-("anticlock"==r?1:-1)*n*m(t)}function m(n){switch(n){case"deg":return u/180;case"rad":return 1;case"grad":return u/200;case"turn":return 2*u}}function _(n,t){for(n=Math.abs(n),t=Math.abs(t);0!=t;)[n,t]=[t,n%t];return n}r.PI=u,r.abs=i,r.sqrt=l,r.resolve_angle=g,r.float=Symbol("float");class d{constructor(n,t){(0,c.assert)(0!=t,"Zero divisor");const r=_(n,t),o=f(n)*f(t);this.numer=o*i(n)/r,this.denom=i(t)/r}[r.float](){return this.numer/this.denom}toString(){return`${this.numer}/${this.denom}`}}function M(n){let t=1;for(let r=2;r<=n;r++)t*=r;return t}r.Fraction=d,d.__name__="Fraction",r.float32_epsilon=1.1920928955078125e-7},
function _(r,e,n,o,s){o(),n.assert=c,n.assert_debug=function(r,e){"undefined"!=typeof DEBUG&&DEBUG&&c(r,e)},n.unreachable=function(r){throw new t("unreachable code"+(null!=r?`: ${r}`:""))};class a extends Error{}n.AssertionError=a,a.__name__="AssertionError";class t extends Error{}function c(r,e){if(!(!0===r||!1!==r&&r()))throw new a(e??"Assertion failed")}n.UnreachableError=t,t.__name__="UnreachableError"},
function _(n,t,e,r,o){r(),e.is_empty=function(n){return 0==n.length},e.is_sorted=l,e.copy=s,e.splice=a,e.head=h,e.insert=function(n,t,e){return a(n,e,0,t)},e.append=function(n,t){return a(n,n.length,0,t)},e.prepend=function(n,t){return a(n,0,0,t)},e.index_of=function(n,t){return n.indexOf(t)},e.includes=g,e.subselect=function(n,t){const e=t.length,r=new n.constructor(e);for(let o=0;o({index:e,key:t(n)})));return e.sort(((n,t)=>{const e=n.key,r=t.key;if(e!==r){if(e>r)return 1;if(en[e[r].index]))},e.minmax2=function(n,t){let e,r,o=1/0,i=-1/0,c=1/0,u=-1/0;const f=Math.min(n.length,t.length);for(let l=0;li&&(i=e),ru&&(u=r));return[o,i,c,u]},e.min_by=function(n,t){if(0==n.length)throw new Error("min_by() called with an empty array");let e=n[0],r=t(e,0);for(let o=1,i=n.length;or&&(e=i,r=c)}return e},e.sum=function(n){let t=0;for(let e=0,r=n.length;et[r]=n+e),0),t},e.every=function(n,t){for(const e of n)if(!t(e))return!1;return!0},e.some=function(n,t){for(const e of n)if(t(e))return!0;return!1},e.find=function(n,t){const r=(0,e.find_index)(n,t);return-1==r?void 0:n[r]},e.find_last=function(n,t){const r=(0,e.find_last_index)(n,t);return-1==r?void 0:n[r]},e.bisect_left_by=y,e.bisect_right_by=x,e.bisect_left=p,e.bisect_right=function(n,t,e=0,r){return x(n,t,(n=>n),e,r)},e.binary_search=function(n,t){const e=p(n,t);return e!=n.length&&n[e]==t?e:null},e.bin_counts=function(n,t){const r=t.length-1,o=Array(r).fill(0);for(let c=0;c(n-t)/r))};const i=n(11),c=n(12);var u=n(14);o("min",u.min),o("max",u.max),o("minmax",u.minmax);const{floor:f}=Math;function l(n){const t=n.length;if(0==t)return!0;let e=n[0];for(let r=1;ro&&(t=o),null==e||e>o-t?e=o-t:e<0&&(e=0);const i=o-e+r.length,c=new n.constructor(i);let u=0;for(;u0?0:r-1;for(;o>=0&&ol(n))),(0,c.assert)(0<=r&&o<=n.length);rl(n))),(0,c.assert)(0<=r&&o<=n.length);rn),e,r)}function w(n,t,e,r,o){const i=(o-e)/(r-t);let c=i*(n-t)+e;return isFinite(c)||(c=i*(n-r)+o,isFinite(c)||e!=o||(c=e)),c}function b(n,t){if(nt[t.length-1])return t.length;if(1==t.length)return 0;let e=0,r=t.length-1;for(;r-e!=1;){const o=e+Math.floor((r-e)/2);n>=t[o]?e=o:r=o}return e}e.contains=g,e.find_index=m(1),e.find_last_index=m(-1),e.sorted_index=p},
-function _(n,o,t,e,f){e(),t.range=r,t.reverse=function*(n){const o=n.length;for(let t=0;t=0);let t=0;for(const e of n){if(!(t++o&&(o=t);return o},t.minmax=function(n){let o=1/0,t=-1/0;for(const e of n)isNaN(e)||(et&&(t=e));return[o,t]};const i=n(12);function*r(n,o,t=1){(0,i.assert)(t>0);const{abs:e,ceil:f,max:r}=Math;null==o&&(o=n,n=0);const l=n<=o?t:-t,c=r(f(e(o-n)/e(t)),0);for(let o=0;o=0);for(const t of n)0==o?yield t:o-=1}const c=Symbol("nothing");function*s(n,o){const t=n.length;if(o>t)return;const e=[...r(o)];for(yield e.map((o=>n[o]));;){let f;for(const n of r(o-1,-1))if(e[n]!=n+t-o){f=n;break}if(null==f)return;e[f]+=1;for(const n of r(f+1,o))e[n]=e[n-1]+1;yield e.map((o=>n[o]))}}},
-function _(t,e,s,i,n){var r;i();const o=t(1),c=t(16),a=t(18),h=o.__importStar(t(19)),_=o.__importStar(t(22)),p=t(12),u=t(40),l=t(9),f=t(8),d=t(33),g=t(41),y=t(27),m=t(42),v=t(32),w=o.__importStar(t(22)),b=t(29),$=t(43),S=new WeakMap;class x extends((0,c.Signalable)()){get is_syncable(){return!0}get type(){return this.constructor.__qualified__}static get __qualified__(){let t=S.get(this);if(null==t){const{__module__:e,__name__:s}=this;t=null!=e?`${e}.${s}`:s,S.set(this,t)}return t}static set __qualified__(t){S.set(this,t)}get[Symbol.toStringTag](){return this.constructor.__qualified__}static _fix_default(t,e){if(void 0===t||t===h.unset)return()=>h.unset;if((0,f.isFunction)(t))return t;if((0,f.isPrimitive)(t))return()=>t;{const e=new v.Cloner;return()=>e.clone(t)}}static define(t){for(const[e,s]of(0,l.entries)((0,f.isFunction)(t)?t(w):t)){if(e in this.prototype._props)throw new Error(`attempted to redefine property '${this.prototype.type}.${e}'`);if(e in this.prototype)throw new Error(`attempted to redefine attribute '${this.prototype.type}.${e}'`);Object.defineProperty(this.prototype,e,{get(){return this.properties[e].get_value()},set(t){return this.setv({[e]:t}),this},configurable:!1,enumerable:!0});const[t,i,n={}]=s,r={type:t,default_value:this._fix_default(i,e),options:n};this.prototype._props={...this.prototype._props,[e]:r}}}static internal(t){const e={};for(const[s,i]of(0,l.entries)((0,f.isFunction)(t)?t(w):t)){const[t,n,r={}]=i;e[s]=[t,n,{...r,internal:!0}]}this.define(e)}static mixins(t){function e(t,e){const s={};for(const[i,n]of(0,l.entries)(e))s[t+i]=n;return s}const s={},i=[];for(const n of(0,f.isArray)(t)?t:[t])if((0,f.isArray)(n)){const[t,r]=n;(0,l.extend)(s,e(t,r)),i.push([t,r])}else{const t=n;(0,l.extend)(s,t),i.push(["",t])}this.define(s),this.prototype._mixins=[...this.prototype._mixins,...i]}static override(t){for(const[e,s]of(0,l.entries)(t)){const t=this._fix_default(s,e);if(!(e in this.prototype._props))throw new Error(`attempted to override nonexistent '${this.prototype.type}.${e}'`);const i=this.prototype._props[e],n={...this.prototype._props};n[e]={...i,default_value:t},this.prototype._props=n}}static override_options(t){for(const[e,s]of(0,l.entries)(t)){if(!(e in this.prototype._props))throw new Error(`attempted to override nonexistent '${this.prototype.type}.${e}'`);const t=this.prototype._props[e],i={...this.prototype._props,[e]:{...t,options:{...t.options,...s}}};this.prototype._props=i}}static toString(){return this.__qualified__}toString(){return`${this.type}(${this.id})`}property(t){if(t in this.properties)return this.properties[t];throw new Error(`unknown property ${this.type}.${t}`)}get attributes(){const t={};for(const e of this)e.is_unset||(t[e.attr]=e.get_value());return t}get dirty_attributes(){const t={};for(const e of this)!e.is_unset&&e.dirty&&(t[e.attr]=e.get_value());return t}[v.clone](t){const e=new Map;for(const s of this)s.dirty&&e.set(s.attr,t.clone(s.get_value()));return new this.constructor(e)}[y.equals](t,e){for(const s of this){const i=t.property(s.attr);if(!e.eq(s.get_value(),i.get_value()))return!1}return!0}[m.pretty](t){const e=t.token,s=[];for(const i of this)if(i.dirty){const n=i.get_value();s.push(`${i.attr}${e(":")} ${t.to_string(n)}`)}return`${this.constructor.__qualified__}${e("(")}${e("{")}${s.join(`${e(",")} `)}${e("}")}${e(")")}`}[d.serialize](t){const e=this.ref();t.add_ref(this,e);const s={};for(const e of this)if(e.syncable&&(t.include_defaults||e.dirty)&&(!e.readonly||!e.is_unset)){const i=e.get_value();s[e.attr]=t.encode(i)}const{type:i,id:n}=this,r={type:"object",name:i,id:n};return(0,l.is_empty)(s)?r:{...r,attributes:s}}constructor(t={}){super(),this.document=null,this.destroyed=new c.Signal0(this,"destroyed"),this.change=new c.Signal0(this,"change"),this.transformchange=new c.Signal0(this,"transformchange"),this.exprchange=new c.Signal0(this,"exprchange"),this.streaming=new c.Signal0(this,"streaming"),this.patching=new c.Signal(this,"patching"),this.properties={},this._watchers=new WeakMap,this._pending=!1,this._changing=!1;const e=(0,f.isPlainObject)(t)&&"id"in t;this.id=e?t.id:(0,u.unique_id)();for(const[t,{type:e,default_value:s,options:i}]of(0,l.entries)(this._props)){let n;if(e instanceof h.PropertyAlias){const s=this.properties[e.attr];if(void 0===s)throw new Error(`can't resolve ${e.attr} before ${t} to create an alias`);Object.defineProperty(this.properties,t,{get:()=>s,configurable:!1,enumerable:!1})}else n=e instanceof _.Kind?new h.PrimitiveProperty(this,t,e,s,i):new e(this,t,_.Any,s,i),this.properties[t]=n}e?(0,p.assert)(1==(0,l.keys)(t).length,"'id' cannot be used together with property initializers"):(this.initialize_props(t),this.finalize(),this.connect_signals())}initialize_props(t){const e=(0,l.dict)(t),s=new Set;for(const t of this){const i=e.get(t.attr);t.initialize(i),s.add(t.attr)}for(const[t,i]of e)s.has(t)||this.property(t).set_value(i)}finalize(){this.initialize()}initialize(){}assert_initialized(){for(const t of this)t.syncable&&!t.readonly&&t.get_value()}connect_signals(){for(const t of this){if(!(t instanceof h.VectorSpec||t instanceof h.ScalarSpec))continue;if(t.is_unset)continue;const e=t.get_value();null!=e.transform&&this.connect(e.transform.change,(()=>this.transformchange.emit())),(0,b.isExpr)(e)&&this.connect(e.expr.change,(()=>this.exprchange.emit()))}}disconnect_signals(){c.Signal.disconnect_receiver(this)}destroy(){this.disconnect_signals(),this.destroyed.emit()}clone(t){const e=(new v.Cloner).clone(this);return null!=t&&e.setv(t),e}_clear_watchers(){this._watchers=new WeakMap}changed_for(t){const e=this._watchers.get(t);return this._watchers.set(t,!1),e??!0}_setv(t,e){const s=e.check_eq,i=new Set,n=this._changing;this._changing=!0;for(const[e,n]of t)!1!==s&&!e.is_unset&&(0,y.is_equal)(e.get_value(),n)||(e.set_value(n),i.add(e));i.size>0&&(this._clear_watchers(),this._pending=!0);for(const t of i)t.change.emit();if(!n){if(!e.no_change)for(;this._pending;)this._pending=!1,this.change.emit();this._pending=!1,this._changing=!1}return i}setv(t,e={}){const s=(0,l.entries)(t);if(0==s.length)return;if(e.silent){this._clear_watchers();for(const[t,e]of s)this.properties[t].set_value(e);return}const i=new Map,n=new Map;for(const[t,e]of s){const s=this.properties[t];i.set(s,e),n.set(s,s.is_unset?void 0:s.get_value())}const r=this._setv(i,e),{document:o}=this;if(null!=o){const t=[];for(const[e,s]of n)r.has(e)&&t.push([e,s,e.get_value()]);for(const[e,s,i]of t)if(e.may_have_refs){o.partially_update_all_models(i);break}const s=e.sync??!0;this._push_changes(t,s)}}ref(){return{id:this.id}}*[Symbol.iterator](){yield*(0,l.values)(this.properties)}*syncable_properties(){for(const t of this)t.syncable&&(yield t)}*own_properties(){const t=Object.getPrototypeOf(this),e=Object.getPrototypeOf(t),s=new Set((0,l.keys)(e._props));for(const t of this)s.has(t.attr)||(yield t)}static _value_record_references(t,e,s){if(!(0,f.isObject)(t)||!(0,a.may_have_refs)(t))return;const{recursive:i}=s;if(t instanceof r){if(!e.has(t)&&(e.add(t),i))for(const s of t.syncable_properties())if(!s.is_unset&&s.may_have_refs){const t=s.get_value();r._value_record_references(t,e,{recursive:i})}}else if((0,f.isIterable)(t))for(const s of t)r._value_record_references(s,e,{recursive:i});else if((0,f.isPlainObject)(t))for(const s of(0,l.values)(t))r._value_record_references(s,e,{recursive:i})}static references(t,e){const s=new Set;return r._value_record_references(t,s,e),s}references(){return r.references(this,{recursive:!0})}_doc_attached(){}_doc_detached(){}attach_document(t){if(null!=this.document){if(this.document==t)return;throw new Error("models must be owned by only a single document")}this.document=t,this._doc_attached()}detach_document(){null!=this.document&&(this._doc_detached(),this.document=null)}_push_changes(t,e){if(!this.is_syncable)return;const{document:s}=this;if(null==s)return;const i=[];for(const[n,,r]of t)if(n.syncable){const t=new g.ModelChangedEvent(s,this,n.attr,r);t.sync=e,i.push(t)}if(0!=i.length){let t;1==i.length?[t]=i:t=new g.DocumentEventBatch(s,i),s._trigger_on_change(t)}}on_change(t,e){for(const s of(0,f.isArray)(t)?t:[t])this.connect(s.change,e)}stream_to(t,e,s,{sync:i}={}){const n=t.get_value();if((0,$.stream_to_columns)(n,e,s),this._clear_watchers(),t.set_value(n),this.streaming.emit(),null!=this.document){const n=new g.ColumnsStreamedEvent(this.document,this,t.attr,e,s);n.sync=i??!0,this.document._trigger_on_change(n)}}patch_to(t,e,{sync:s}={}){const i=t.get_value(),n=(0,$.patch_to_columns)(i,e);if(this._clear_watchers(),t.set_value(i),this.patching.emit([...n]),null!=this.document){const i=new g.ColumnsPatchedEvent(this.document,this,t.attr,e);i.sync=s??!0,this.document._trigger_on_change(i)}}}s.HasProps=x,(r=x).prototype._props={},r.prototype._mixins=[]},
+function _(n,o,t,e,f){e(),t.iter=function*(n){(0,r.isIterable)(n)?yield*n:yield n},t.range=l,t.reverse=function*(n){const o=n.length;for(let t=0;t=0);let t=0;for(const e of n){if(!(t++o&&(o=t);return o},t.minmax=function(n){let o=1/0,t=-1/0;for(const e of n)isNaN(e)||(et&&(t=e));return[o,t]};const i=n(12),r=n(8);function*l(n,o,t=1){(0,i.assert)(t>0);const{abs:e,ceil:f,max:r}=Math;null==o&&(o=n,n=0);const l=n<=o?t:-t,c=r(f(e(o-n)/e(t)),0);for(let o=0;o=0);for(const t of n)0==o?yield t:o-=1}const s=Symbol("nothing");function*u(n,o){const t=n.length;if(o>t)return;const e=[...l(o)];for(yield e.map((o=>n[o]));;){let f;for(const n of l(o-1,-1))if(e[n]!=n+t-o){f=n;break}if(null==f)return;e[f]+=1;for(const n of l(f+1,o))e[n]=e[n-1]+1;yield e.map((o=>n[o]))}}},
+function _(t,e,s,i,n){var r;i();const o=t(1),c=t(16),a=t(18),h=o.__importStar(t(19)),_=o.__importStar(t(22)),p=t(12),u=t(41),l=t(9),f=t(8),d=t(33),g=t(42),y=t(27),m=t(43),v=t(32),w=o.__importStar(t(22)),b=t(29),$=t(44),S=new WeakMap;class x extends((0,c.Signalable)()){get is_syncable(){return!0}get type(){return this.constructor.__qualified__}static get __qualified__(){let t=S.get(this);if(null==t){const{__module__:e,__name__:s}=this;t=null!=e?`${e}.${s}`:s,S.set(this,t)}return t}static set __qualified__(t){S.set(this,t)}get[Symbol.toStringTag](){return this.constructor.__qualified__}static _fix_default(t,e){if(void 0===t||t===h.unset)return()=>h.unset;if((0,f.isFunction)(t))return t;if((0,f.isPrimitive)(t))return()=>t;{const e=new v.Cloner;return()=>e.clone(t)}}static define(t){for(const[e,s]of(0,l.entries)((0,f.isFunction)(t)?t(w):t)){if(e in this.prototype._props)throw new Error(`attempted to redefine property '${this.prototype.type}.${e}'`);if(e in this.prototype)throw new Error(`attempted to redefine attribute '${this.prototype.type}.${e}'`);Object.defineProperty(this.prototype,e,{get(){return this.properties[e].get_value()},set(t){return this.setv({[e]:t}),this},configurable:!1,enumerable:!0});const[t,i,n={}]=s,r={type:t,default_value:this._fix_default(i,e),options:n};this.prototype._props={...this.prototype._props,[e]:r}}}static internal(t){const e={};for(const[s,i]of(0,l.entries)((0,f.isFunction)(t)?t(w):t)){const[t,n,r={}]=i;e[s]=[t,n,{...r,internal:!0}]}this.define(e)}static mixins(t){function e(t,e){const s={};for(const[i,n]of(0,l.entries)(e))s[t+i]=n;return s}const s={},i=[];for(const n of(0,f.isArray)(t)?t:[t])if((0,f.isArray)(n)){const[t,r]=n;(0,l.extend)(s,e(t,r)),i.push([t,r])}else{const t=n;(0,l.extend)(s,t),i.push(["",t])}this.define(s),this.prototype._mixins=[...this.prototype._mixins,...i]}static override(t){for(const[e,s]of(0,l.entries)(t)){const t=this._fix_default(s,e);if(!(e in this.prototype._props))throw new Error(`attempted to override nonexistent '${this.prototype.type}.${e}'`);const i=this.prototype._props[e],n={...this.prototype._props};n[e]={...i,default_value:t},this.prototype._props=n}}static override_options(t){for(const[e,s]of(0,l.entries)(t)){if(!(e in this.prototype._props))throw new Error(`attempted to override nonexistent '${this.prototype.type}.${e}'`);const t=this.prototype._props[e],i={...this.prototype._props,[e]:{...t,options:{...t.options,...s}}};this.prototype._props=i}}static toString(){return this.__qualified__}toString(){return`${this.type}(${this.id})`}property(t){if(t in this.properties)return this.properties[t];throw new Error(`unknown property ${this.type}.${t}`)}get attributes(){const t={};for(const e of this)e.is_unset||(t[e.attr]=e.get_value());return t}get dirty_attributes(){const t={};for(const e of this)!e.is_unset&&e.dirty&&(t[e.attr]=e.get_value());return t}[v.clone](t){const e=new Map;for(const s of this)s.dirty&&e.set(s.attr,t.clone(s.get_value()));return new this.constructor(e)}[y.equals](t,e){for(const s of this){const i=t.property(s.attr);if(!e.eq(s.get_value(),i.get_value()))return!1}return!0}[m.pretty](t){const e=t.token,s=[];for(const i of this)if(i.dirty){const n=i.get_value();s.push(`${i.attr}${e(":")} ${t.to_string(n)}`)}return`${this.constructor.__qualified__}${e("(")}${e("{")}${s.join(`${e(",")} `)}${e("}")}${e(")")}`}[d.serialize](t){const e=this.ref();t.add_ref(this,e);const s={};for(const e of this)if(e.syncable&&(t.include_defaults||e.dirty)&&(!e.readonly||!e.is_unset)){const i=e.get_value();s[e.attr]=t.encode(i)}const{type:i,id:n}=this,r={type:"object",name:i,id:n};return(0,l.is_empty)(s)?r:{...r,attributes:s}}constructor(t={}){super(),this.document=null,this.destroyed=new c.Signal0(this,"destroyed"),this.change=new c.Signal0(this,"change"),this.transformchange=new c.Signal0(this,"transformchange"),this.exprchange=new c.Signal0(this,"exprchange"),this.streaming=new c.Signal0(this,"streaming"),this.patching=new c.Signal(this,"patching"),this.properties={},this._watchers=new WeakMap,this._pending=!1,this._changing=!1;const e=(0,f.isPlainObject)(t)&&"id"in t;this.id=e?t.id:(0,u.unique_id)();for(const[t,{type:e,default_value:s,options:i}]of(0,l.entries)(this._props)){let n;if(e instanceof h.PropertyAlias){const s=this.properties[e.attr];if(void 0===s)throw new Error(`can't resolve ${e.attr} before ${t} to create an alias`);Object.defineProperty(this.properties,t,{get:()=>s,configurable:!1,enumerable:!1})}else n=e instanceof _.Kind?new h.PrimitiveProperty(this,t,e,s,i):new e(this,t,_.Any,s,i),this.properties[t]=n}e?(0,p.assert)(1==(0,l.keys)(t).length,"'id' cannot be used together with property initializers"):(this.initialize_props(t),this.finalize(),this.connect_signals())}initialize_props(t){const e=(0,l.dict)(t),s=new Set;for(const t of this){const i=e.get(t.attr);t.initialize(i),s.add(t.attr)}for(const[t,i]of e)s.has(t)||this.property(t).set_value(i)}finalize(){this.initialize()}initialize(){}assert_initialized(){for(const t of this)t.syncable&&!t.readonly&&t.get_value()}connect_signals(){for(const t of this){if(!(t instanceof h.VectorSpec||t instanceof h.ScalarSpec))continue;if(t.is_unset)continue;const e=t.get_value();null!=e.transform&&this.connect(e.transform.change,(()=>this.transformchange.emit())),(0,b.isExpr)(e)&&this.connect(e.expr.change,(()=>this.exprchange.emit()))}}disconnect_signals(){c.Signal.disconnect_receiver(this)}destroy(){this.disconnect_signals(),this.destroyed.emit()}clone(t){const e=(new v.Cloner).clone(this);return null!=t&&e.setv(t),e}_clear_watchers(){this._watchers=new WeakMap}changed_for(t){const e=this._watchers.get(t);return this._watchers.set(t,!1),e??!0}_setv(t,e){const s=e.check_eq,i=new Set,n=this._changing;this._changing=!0;for(const[e,n]of t)!1!==s&&!e.is_unset&&(0,y.is_equal)(e.get_value(),n)||(e.set_value(n),i.add(e));i.size>0&&(this._clear_watchers(),this._pending=!0);for(const t of i)t.change.emit();if(!n){if(!e.no_change)for(;this._pending;)this._pending=!1,this.change.emit();this._pending=!1,this._changing=!1}return i}setv(t,e={}){const s=(0,l.entries)(t);if(0==s.length)return;if(e.silent){this._clear_watchers();for(const[t,e]of s)this.properties[t].set_value(e);return}const i=new Map,n=new Map;for(const[t,e]of s){const s=this.properties[t];i.set(s,e),n.set(s,s.is_unset?void 0:s.get_value())}const r=this._setv(i,e),{document:o}=this;if(null!=o){const t=[];for(const[e,s]of n)r.has(e)&&t.push([e,s,e.get_value()]);for(const[e,s,i]of t)if(e.may_have_refs){o.partially_update_all_models(i);break}const s=e.sync??!0;this._push_changes(t,s)}}ref(){return{id:this.id}}*[Symbol.iterator](){yield*(0,l.values)(this.properties)}*syncable_properties(){for(const t of this)t.syncable&&(yield t)}*own_properties(){const t=Object.getPrototypeOf(this),e=Object.getPrototypeOf(t),s=new Set((0,l.keys)(e._props));for(const t of this)s.has(t.attr)||(yield t)}static _value_record_references(t,e,s){if(!(0,f.isObject)(t)||!(0,a.may_have_refs)(t))return;const{recursive:i}=s;if(t instanceof r){if(!e.has(t)&&(e.add(t),i))for(const s of t.syncable_properties())if(!s.is_unset&&s.may_have_refs){const t=s.get_value();r._value_record_references(t,e,{recursive:i})}}else if((0,f.isIterable)(t))for(const s of t)r._value_record_references(s,e,{recursive:i});else if((0,f.isPlainObject)(t))for(const s of(0,l.values)(t))r._value_record_references(s,e,{recursive:i})}static references(t,e){const s=new Set;return r._value_record_references(t,s,e),s}references(){return r.references(this,{recursive:!0})}_doc_attached(){}_doc_detached(){}attach_document(t){if(null!=this.document){if(this.document==t)return;throw new Error("models must be owned by only a single document")}this.document=t,this._doc_attached()}detach_document(){null!=this.document&&(this._doc_detached(),this.document=null)}_push_changes(t,e){if(!this.is_syncable)return;const{document:s}=this;if(null==s)return;const i=[];for(const[n,,r]of t)if(n.syncable){const t=new g.ModelChangedEvent(s,this,n.attr,r);t.sync=e,i.push(t)}if(0!=i.length){let t;1==i.length?[t]=i:t=new g.DocumentEventBatch(s,i),s._trigger_on_change(t)}}on_change(t,e){for(const s of(0,f.isArray)(t)?t:[t])this.connect(s.change,e)}stream_to(t,e,s,{sync:i}={}){const n=t.get_value();if((0,$.stream_to_columns)(n,e,s),this._clear_watchers(),t.set_value(n),this.streaming.emit(),null!=this.document){const n=new g.ColumnsStreamedEvent(this.document,this,t.attr,e,s);n.sync=i??!0,this.document._trigger_on_change(n)}}patch_to(t,e,{sync:s}={}){const i=t.get_value(),n=(0,$.patch_to_columns)(i,e);if(this._clear_watchers(),t.set_value(i),this.patching.emit([...n]),null!=this.document){const i=new g.ColumnsPatchedEvent(this.document,this,t.attr,e);i.sync=s??!0,this.document._trigger_on_change(i)}}}s.HasProps=x,(r=x).prototype._props={},r.prototype._mixins=[]},
function _(n,e,t,s,r){s(),t.Signalable=function(){return class{connect(n,e){return n.connect(e,this)}disconnect(n,e){return n.disconnect(e,this)}}};const l=n(17),i=n(10);class o{constructor(n,e){this.sender=n,this.name=e}connect(n,e=null){t.receivers_for_sender.has(this.sender)||t.receivers_for_sender.set(this.sender,[]);const s=t.receivers_for_sender.get(this.sender);if(null!=f(s,this,n,e))return!1;const r=e??n;u.has(r)||u.set(r,[]);const l=u.get(r),i={signal:this,slot:n,context:e};return s.push(i),l.push(i),!0}disconnect(n,e=null){const s=t.receivers_for_sender.get(this.sender);if(null==s||0===s.length)return!1;const r=f(s,this,n,e);if(null==r)return!1;const l=e??n,i=u.get(l);return r.signal=null,g(s),g(i),!0}emit(n){const e=t.receivers_for_sender.get(this.sender)??[];for(const{signal:t,slot:s,context:r}of e)t===this&&s.call(r,n,this.sender)}}t.Signal=o,o.__name__="Signal";class c extends o{emit(){super.emit(void 0)}}t.Signal0=c,c.__name__="Signal0",function(n){n.disconnect_between=function(n,e){const s=t.receivers_for_sender.get(n);if(null==s||0===s.length)return;const r=u.get(e);if(null!=r&&0!==r.length){for(const e of r){if(null==e.signal)return;e.signal.sender===n&&(e.signal=null)}g(s),g(r)}},n.disconnect_sender=function(n){const e=t.receivers_for_sender.get(n);if(null!=e&&0!==e.length){for(const n of e){if(null==n.signal)return;const e=n.context??n.slot;n.signal=null,g(u.get(e))}g(e)}},n.disconnect_receiver=function(n,e,s){const r=u.get(n);if(null!=r&&0!==r.length){for(const n of r){if(null==n.signal)return;if(null!=e&&n.slot!=e)continue;const r=n.signal.sender;null!=s&&s.has(r)||(n.signal=null,g(t.receivers_for_sender.get(r)))}g(r)}},n.disconnect_all=function(n){const e=t.receivers_for_sender.get(n);if(null!=e&&0!==e.length){for(const n of e)n.signal=null;g(e)}const s=u.get(n);if(null!=s&&0!==s.length){for(const n of s)n.signal=null;g(s)}}}(o||(t.Signal=o={})),t.receivers_for_sender=new WeakMap;const u=new WeakMap;function f(n,e,t,s){return(0,i.find)(n,(n=>n.signal===e&&n.slot===t&&n.context===s))}const a=new Set;function g(n){0==a.size&&(async()=>{await(0,l.defer)(),function(){for(const n of a)(0,i.remove_by)(n,(n=>null==n.signal));a.clear()}()})(),a.add(n)}},
function _(e,n,t,o,r){o(),t.defer=function(){return new Promise((e=>{const n=a++;i.set(n,e),s.port2.postMessage(n)}))},t.delay=l,t.poll=async function(e,n=50,t=500){for(;!e()&&t>=0;)await l(n),t-=n},t.paint=function(){return new Promise((e=>{requestAnimationFrame((()=>e()))}))},t.idle=function(){return new Promise((e=>{requestIdleCallback((()=>e()))}))};const s=new MessageChannel,i=new Map;s.port1.onmessage=e=>{const n=e.data,t=i.get(n);if(null!=t)try{t()}finally{i.delete(n)}};let a=1;function l(e){return new Promise((n=>setTimeout(n,e)))}},
function _(n,r,s,e,t){e(),s.is_ref=function(n){return(0,i.isPlainObject)(n)&&"id"in n&&!("type"in n)},s.is_HasRefs=u,s.may_have_refs=function(n){if(f(n))return n[s.has_refs];const r=n.constructor;if(u(r))return r[s.has_refs];return!0};const i=n(8);function f(n){return s.has_refs in n}function u(n){return(0,i.isObject)(n)&&f(n)}s.has_refs=Symbol("has_refs")},
-function _(e,t,r,n,a){n(),r.TextBaselineSpec=r.TextAlignSpec=r.FontStyleSpec=r.FontSizeSpec=r.FontSpec=r.LineDashSpec=r.LineCapSpec=r.LineJoinSpec=r.MarkerSpec=r.ExtMarkerType=r.ArraySpec=r.NullStringSpec=void 0,r.isSpec=b,r.use_theme=function(e=null){C=e},r.Alias=function(e){return new N(e)};const s=e(1),i=e(16),l=e(20),_=s.__importStar(e(21)),o=e(25),c=e(10),u=e(13),d=e(11),S=e(23),p=e(28),h=e(8),m=e(29),f=e(30),v=e(22),y=e(31),x=e(38),g=e(12),w=e(33),A=e(39);function z(e){try{return JSON.stringify(e)}catch{return e.toString()}}function b(e){return(0,h.isPlainObject)(e)&&(void 0===e.value?0:1)+(void 0===e.field?0:1)+(void 0===e.expr?0:1)==1}a("Uniform",A.Uniform),a("UniformScalar",A.UniformScalar),a("UniformVector",A.UniformVector);let C=null;r.unset=Symbol("unset");class F extends Error{}r.UnsetValueError=F,F.__name__="UnsetValueError";class q{get syncable(){return!this.internal}get is_unset(){return this._value===r.unset}get initialized(){return this._initialized}initialize(e=r.unset){if(this._initialized)throw new Error("already initialized");let t=r.unset;if(e!==r.unset)t=e,this._dirty=!0;else{const e=this._default_override();if(e!==r.unset)t=e;else{let e=!1;if(null!=C){const r=C.get(this.obj,this.attr);void 0!==r&&(t=r,e=!0)}e||(t=this.default_value(this.obj))}}t!==r.unset?(null!=this.kind.coerce&&(t=this.kind.coerce(t)),this._update(t)):this._value=r.unset,this._initialized=!0}get_value(){if(this._value!==r.unset)return this._value;throw new F(`${this.obj}.${this.attr} is unset`)}set_value(e){this._initialized?(this._update(e),this._dirty=!0):this.initialize(e),x.diagnostics.report(this)}_default_override(){return r.unset}get dirty(){return this._dirty}constructor(e,t,n,a,s={}){this._value=r.unset,this._initialized=!1,this._dirty=!1,this.obj=e,this.attr=t,this.kind=n,this.default_value=a,this.change=new i.Signal0(this.obj,"change"),this.internal=s.internal??!1,this.readonly=s.readonly??!1,this.convert=s.convert,this.on_update=s.on_update,this.may_have_refs=n.may_have_refs()}_update(e){if(this.validate(e),null!=this.convert){const t=this.convert(e,this.obj);void 0!==t&&(e=t)}this._value=e,this.on_update?.(e,this.obj)}toString(){return`Prop(${this.obj}.${this.attr}, value: ${z(this._value)})`}normalize(e){return e}validate(e){if(!this.valid(e))throw new Error(`${this.obj}.${this.attr} given invalid value: ${z(e)}`)}valid(e){return this.kind.valid(e)}}r.Property=q,q.__name__="Property";class N{constructor(e){this.attr=e}}r.PropertyAlias=N,N.__name__="PropertyAlias";class U extends q{}r.PrimitiveProperty=U,U.__name__="PrimitiveProperty";class E extends U{_default_override(){return f.settings.dev?"Bokeh":r.unset}}r.Font=E,E.__name__="Font";class $ extends q{constructor(){super(...arguments),this._value=r.unset}get_value(){if(this._value!==r.unset)return this._value;throw new Error(`${this.obj}.${this.attr} is unset`)}_update(e){if(b(e)?this._value=e:this._value={value:e},(0,h.isPlainObject)(this._value)){const{_value:e}=this;this._value[w.serialize]=t=>{const{value:r,field:n,expr:a,transform:s,units:i}=e;return t.encode_struct(void 0!==r?{type:"value",value:r,transform:s,units:i}:void 0!==n?{type:"field",field:n,transform:s,units:i}:{type:"expr",expr:a,transform:s,units:i})}}(0,m.isValue)(this._value)&&this.validate(this._value.value)}materialize(e){return e}scalar(e,t){return new A.UniformScalar(e,t)}uniform(e){const t=this.get_value(),r=e.get_length()??1;if((0,m.isExpr)(t)){const{expr:n,transform:a}=t;let s=n.compute(e);return null!=a&&(s=a.compute(s)),s=this.materialize(s),this.scalar(s,r)}{const{value:e,transform:n}=t;let a=e;return null!=n&&(a=n.compute(a)),a=this.materialize(a),this.scalar(a,r)}}}r.ScalarSpec=$,$.__name__="ScalarSpec";class j extends ${}r.AnyScalar=j,j.__name__="AnyScalar";class B extends ${}r.DictScalar=B,B.__name__="DictScalar";class D extends ${}r.ColorScalar=D,D.__name__="ColorScalar";class L extends ${}r.NumberScalar=L,L.__name__="NumberScalar";class T extends ${}r.StringScalar=T,T.__name__="StringScalar";class P extends ${}r.NullStringScalar=P,P.__name__="NullStringScalar";class k extends ${}r.ArrayScalar=k,k.__name__="ArrayScalar";class V extends ${}r.LineJoinScalar=V,V.__name__="LineJoinScalar";class J extends ${}r.LineCapScalar=J,J.__name__="LineCapScalar";class X extends ${}r.LineDashScalar=X,X.__name__="LineDashScalar";class Y extends ${_default_override(){return f.settings.dev?"Bokeh":r.unset}}r.FontScalar=Y,Y.__name__="FontScalar";class M extends ${}r.FontSizeScalar=M,M.__name__="FontSizeScalar";class G extends ${}r.FontStyleScalar=G,G.__name__="FontStyleScalar";class I extends ${}r.TextAlignScalar=I,I.__name__="TextAlignScalar";class O extends ${}r.TextBaselineScalar=O,O.__name__="TextBaselineScalar";class R extends q{constructor(){super(...arguments),this._value=r.unset}get_value(){if(this._value!==r.unset)return this._value;throw new Error(`${this.obj}.${this.attr} is unset`)}_update(e){if(b(e)?this._value=e:this._value={value:e},(0,h.isPlainObject)(this._value)){const{_value:e}=this;this._value[w.serialize]=t=>{const{value:r,field:n,expr:a,transform:s,units:i}=e;return t.encode_struct(void 0!==r?{type:"value",value:r,transform:s,units:i}:void 0!==n?{type:"field",field:n,transform:s,units:i}:{type:"expr",expr:a,transform:s,units:i})}}(0,m.isValue)(this._value)&&this.validate(this._value.value)}materialize(e){return e}v_materialize(e){return e}scalar(e,t){return new A.UniformScalar(e,t)}vector(e){return new A.UniformVector(e)}uniform(e){const t=this.get_value(),r=e.get_length()??1;if((0,m.isField)(t)){const{field:n,transform:a}=t;let s=e.get_column(n);if(null!=s)return null!=a&&(s=a.v_compute(s)),s=this.v_materialize(s),this.vector(s);{const e=`attempted to retrieve property array for nonexistent field '${n}'`;if(f.settings.force_fields)throw new Error(e);return l.logger.warn(e),this.scalar(null,r)}}if((0,m.isExpr)(t)){const{expr:r,transform:n}=t;let a=r.v_compute(e);return null!=n&&(a=n.v_compute(a)),a=this.v_materialize(a),this.vector(a)}if((0,m.isValue)(t)){const{value:e,transform:n}=t;let a=e;return null!=n&&(a=n.compute(a)),a=this.materialize(a),this.scalar(a,r)}(0,g.unreachable)()}array(e){let t;const r=e.get_length()??1,n=this.get_value();if((0,m.isField)(n)){const{field:a}=n,s=e.get_column(a);if(null!=s)t=this.normalize(s);else{const e=`attempted to retrieve property array for nonexistent field '${a}'`;if(f.settings.force_fields)throw new Error(e);l.logger.warn(e);const n=new Float64Array(r);n.fill(NaN),t=n}}else if((0,m.isExpr)(n)){const{expr:r}=n;t=this.normalize(r.v_compute(e))}else{const e=this.normalize([n.value])[0];if((0,h.isNumber)(e)){const n=new Float64Array(r);n.fill(e),t=n}else t=(0,c.repeat)(e,r)}const{transform:a}=n;return null!=a&&(t=a.v_compute(t)),t}}r.VectorSpec=R,R.__name__="VectorSpec";class H extends R{}r.DataSpec=H,H.__name__="DataSpec";class K extends R{constructor(){super(...arguments),this._value=r.unset}_update(e){if(super._update(e),this._value!==r.unset){const{units:e}=this._value;if(null!=e&&!(0,c.includes)(this.valid_units,e))throw new Error(`units must be one of ${this.valid_units.join(", ")}; got: ${e}`)}}get units(){return this._value!==r.unset?this._value.units??this.default_units:this.default_units}set units(e){if(this._value===r.unset)throw new Error(`${this.obj}.${this.attr} is unset`);e!=this.default_units?this._value.units=e:delete this._value.units}}r.UnitsSpec=K,K.__name__="UnitsSpec";class Q extends K{array(e){return new Float64Array(super.array(e))}}r.NumberUnitsSpec=Q,Q.__name__="NumberUnitsSpec";class W extends H{}r.BaseCoordinateSpec=W,W.__name__="BaseCoordinateSpec";class Z extends W{}r.CoordinateSpec=Z,Z.__name__="CoordinateSpec";class ee extends W{}r.CoordinateSeqSpec=ee,ee.__name__="CoordinateSeqSpec";class te extends W{}r.CoordinateSeqSeqSeqSpec=te,te.__name__="CoordinateSeqSeqSeqSpec";class re extends Z{constructor(){super(...arguments),this.dimension="x"}}r.XCoordinateSpec=re,re.__name__="XCoordinateSpec";class ne extends Z{constructor(){super(...arguments),this.dimension="y"}}r.YCoordinateSpec=ne,ne.__name__="YCoordinateSpec";class ae extends ee{constructor(){super(...arguments),this.dimension="x"}}r.XCoordinateSeqSpec=ae,ae.__name__="XCoordinateSeqSpec";class se extends ee{constructor(){super(...arguments),this.dimension="y"}}r.YCoordinateSeqSpec=se,se.__name__="YCoordinateSeqSpec";class ie extends te{constructor(){super(...arguments),this.dimension="x"}}r.XCoordinateSeqSeqSeqSpec=ie,ie.__name__="XCoordinateSeqSeqSeqSpec";class le extends te{constructor(){super(...arguments),this.dimension="y"}}r.YCoordinateSeqSeqSeqSpec=le,le.__name__="YCoordinateSeqSeqSeqSpec";class _e extends Q{get default_units(){return"rad"}get valid_units(){return[..._.AngleUnits]}materialize(e){return e*-(0,d.to_radians_coeff)(this.units)}v_materialize(e){const t=-(0,d.to_radians_coeff)(this.units),r=new Float32Array(e.length);return(0,u.mul)(e,t,r),r}array(e){throw new Error("not supported")}}r.AngleSpec=_e,_e.__name__="AngleSpec";class oe extends Q{get default_units(){return"data"}get valid_units(){return[..._.SpatialUnits]}}r.DistanceSpec=oe,oe.__name__="DistanceSpec";class ce extends oe{materialize(e){return e??NaN}}r.NullDistanceSpec=ce,ce.__name__="NullDistanceSpec";class ue extends H{v_materialize(e){return new Uint8Array(e)}array(e){return new Uint8Array(super.array(e))}}r.BooleanSpec=ue,ue.__name__="BooleanSpec";class de extends H{v_materialize(e){return(0,h.isTypedArray)(e)?e:new Int32Array(e)}array(e){return new Int32Array(super.array(e))}}r.IntSpec=de,de.__name__="IntSpec";class Se extends H{v_materialize(e){return(0,h.isTypedArray)(e)?e:new Float64Array(e)}array(e){return new Float64Array(super.array(e))}}r.NumberSpec=Se,Se.__name__="NumberSpec";class pe extends Se{valid(e){return(0,h.isNumber)(e)&&e>=0}}r.ScreenSizeSpec=pe,pe.__name__="ScreenSizeSpec";class he extends H{materialize(e){return(0,S.encode_rgba)((0,S.color2rgba)(e))}v_materialize(e){if(!(0,y.is_NDArray)(e))return this._from_css_array(e);if("uint32"==e.dtype&&1==e.dimension)return(0,p.to_big_endian)(e);if("uint8"==e.dtype&&1==e.dimension){const[t]=e.shape,r=new o.RGBAArray(4*t);let n=0;for(const t of e)r[n++]=t,r[n++]=t,r[n++]=t,r[n++]=255;return new o.ColorArray(r.buffer)}if("uint8"==e.dtype&&2==e.dimension){const[t,r]=e.shape;if(4==r)return new o.ColorArray(e.buffer);if(3==r){const n=new o.RGBAArray(4*t);for(let a=0,s=0;a{const{value:r,field:n,expr:a,transform:s,units:i}=e;return t.encode_struct(void 0!==r?{type:"value",value:r,transform:s,units:i}:void 0!==n?{type:"field",field:n,transform:s,units:i}:{type:"expr",expr:a,transform:s,units:i})}}(0,m.isValue)(this._value)&&this.validate(this._value.value)}materialize(e){return e}scalar(e,t){return new A.UniformScalar(e,t)}uniform(e){const t=this.get_value(),r=e.get_length()??1;if((0,m.isExpr)(t)){const{expr:n,transform:a}=t;let s=n.compute(e);return null!=a&&(s=a.compute(s)),s=this.materialize(s),this.scalar(s,r)}{const{value:e,transform:n}=t;let a=e;return null!=n&&(a=n.compute(a)),a=this.materialize(a),this.scalar(a,r)}}}r.ScalarSpec=j,j.__name__="ScalarSpec";class B extends j{}r.AnyScalar=B,B.__name__="AnyScalar";class D extends j{}r.DictScalar=D,D.__name__="DictScalar";class L extends j{}r.ColorScalar=L,L.__name__="ColorScalar";class T extends j{}r.NumberScalar=T,T.__name__="NumberScalar";class P extends j{}r.StringScalar=P,P.__name__="StringScalar";class V extends j{}r.NullStringScalar=V,V.__name__="NullStringScalar";class k extends j{}r.ArrayScalar=k,k.__name__="ArrayScalar";class J extends j{}r.LineJoinScalar=J,J.__name__="LineJoinScalar";class X extends j{}r.LineCapScalar=X,X.__name__="LineCapScalar";class Y extends j{}r.LineDashScalar=Y,Y.__name__="LineDashScalar";class M extends j{_default_override(){return f.settings.dev?"Bokeh":r.unset}}r.FontScalar=M,M.__name__="FontScalar";class G extends j{}r.FontSizeScalar=G,G.__name__="FontSizeScalar";class I extends j{}r.FontStyleScalar=I,I.__name__="FontStyleScalar";class O extends j{}r.TextAlignScalar=O,O.__name__="TextAlignScalar";class R extends j{}r.TextBaselineScalar=R,R.__name__="TextBaselineScalar";class H extends N{constructor(){super(...arguments),this._value=r.unset}get_value(){if(this._value!==r.unset)return this._value;throw new Error(`${this.obj}.${this.attr} is unset`)}_update(e){if(C(e)?this._value=e:this._value={value:e},(0,h.isPlainObject)(this._value)){const{_value:e}=this;this._value[w.serialize]=t=>{const{value:r,field:n,expr:a,transform:s,units:i}=e;return t.encode_struct(void 0!==r?{type:"value",value:r,transform:s,units:i}:void 0!==n?{type:"field",field:n,transform:s,units:i}:{type:"expr",expr:a,transform:s,units:i})}}(0,m.isValue)(this._value)&&this.validate(this._value.value)}materialize(e){return e}v_materialize(e){return e}scalar(e,t){return new A.UniformScalar(e,t)}vector(e){return new A.UniformVector(e)}uniform(e){const t=this.get_value(),r=e.get_length()??1;if((0,m.isField)(t)){const{field:n,transform:a}=t;let s=e.get_column(n);if(null!=s)return null!=a&&(s=a.v_compute(s)),s=this.v_materialize(s),this.vector(s);{const e=`attempted to retrieve property array for nonexistent field '${n}'`;if(f.settings.force_fields)throw new Error(e);return l.logger.warn(e),this.scalar(null,r)}}if((0,m.isExpr)(t)){const{expr:r,transform:n}=t;let a=r.v_compute(e);return null!=n&&(a=n.v_compute(a)),a=this.v_materialize(a),this.vector(a)}if((0,m.isValue)(t)){const{value:e,transform:n}=t;let a=e;return null!=n&&(a=n.compute(a)),a=this.materialize(a),this.scalar(a,r)}(0,g.unreachable)()}array(e){let t;const r=e.get_length()??1,n=this.get_value();if((0,m.isField)(n)){const{field:a}=n,s=e.get_column(a);if(null!=s)t=this.normalize(s);else{const e=`attempted to retrieve property array for nonexistent field '${a}'`;if(f.settings.force_fields)throw new Error(e);l.logger.warn(e);const n=new Float64Array(r);n.fill(NaN),t=n}}else if((0,m.isExpr)(n)){const{expr:r}=n;t=this.normalize(r.v_compute(e))}else{const e=this.normalize([n.value])[0];if((0,h.isNumber)(e)){const n=new Float64Array(r);n.fill(e),t=n}else t=(0,c.repeat)(e,r)}const{transform:a}=n;return null!=a&&(t=a.v_compute(t)),t}}r.VectorSpec=H,H.__name__="VectorSpec";class K extends H{}r.DataSpec=K,K.__name__="DataSpec";class Q extends H{constructor(){super(...arguments),this._value=r.unset}_update(e){if(super._update(e),this._value!==r.unset){const{units:e}=this._value;if(null!=e&&!(0,c.includes)(this.valid_units,e))throw new Error(`units must be one of ${this.valid_units.join(", ")}; got: ${e}`)}}get units(){return this._value!==r.unset?this._value.units??this.default_units:this.default_units}set units(e){if(this._value===r.unset)throw new Error(`${this.obj}.${this.attr} is unset`);e!=this.default_units?this._value.units=e:delete this._value.units}}r.UnitsSpec=Q,Q.__name__="UnitsSpec";class W extends Q{array(e){return new Float64Array(super.array(e))}}r.NumberUnitsSpec=W,W.__name__="NumberUnitsSpec";class Z extends K{}r.BaseCoordinateSpec=Z,Z.__name__="BaseCoordinateSpec";class ee extends Z{}r.CoordinateSpec=ee,ee.__name__="CoordinateSpec";class te extends Z{}r.CoordinateSeqSpec=te,te.__name__="CoordinateSeqSpec";class re extends Z{}r.CoordinateSeqSeqSeqSpec=re,re.__name__="CoordinateSeqSeqSeqSpec";class ne extends ee{constructor(){super(...arguments),this.dimension="x"}}r.XCoordinateSpec=ne,ne.__name__="XCoordinateSpec";class ae extends ee{constructor(){super(...arguments),this.dimension="y"}}r.YCoordinateSpec=ae,ae.__name__="YCoordinateSpec";class se extends te{constructor(){super(...arguments),this.dimension="x"}}r.XCoordinateSeqSpec=se,se.__name__="XCoordinateSeqSpec";class ie extends te{constructor(){super(...arguments),this.dimension="y"}}r.YCoordinateSeqSpec=ie,ie.__name__="YCoordinateSeqSpec";class le extends re{constructor(){super(...arguments),this.dimension="x"}}r.XCoordinateSeqSeqSeqSpec=le,le.__name__="XCoordinateSeqSeqSeqSpec";class _e extends re{constructor(){super(...arguments),this.dimension="y"}}r.YCoordinateSeqSeqSeqSpec=_e,_e.__name__="YCoordinateSeqSeqSeqSpec";class oe extends W{get default_units(){return"rad"}get valid_units(){return[..._.AngleUnits]}materialize(e){return e*-(0,d.to_radians_coeff)(this.units)}v_materialize(e){const t=-(0,d.to_radians_coeff)(this.units),r=new Float32Array(e.length);return(0,u.mul)(e,t,r),r}array(e){throw new Error("not supported")}}r.AngleSpec=oe,oe.__name__="AngleSpec";class ce extends W{get default_units(){return"data"}get valid_units(){return[..._.SpatialUnits]}}r.DistanceSpec=ce,ce.__name__="DistanceSpec";class ue extends ce{materialize(e){return e??NaN}}r.NullDistanceSpec=ue,ue.__name__="NullDistanceSpec";class de extends K{v_materialize(e){return new Uint8Array(e)}array(e){return new Uint8Array(super.array(e))}}r.BooleanSpec=de,de.__name__="BooleanSpec";class Se extends K{v_materialize(e){return(0,h.isTypedArray)(e)?e:new Int32Array(e)}array(e){return new Int32Array(super.array(e))}}r.IntSpec=Se,Se.__name__="IntSpec";class pe extends K{v_materialize(e){return(0,h.isTypedArray)(e)?e:new Float64Array(e)}array(e){return new Float64Array(super.array(e))}}r.NumberSpec=pe,pe.__name__="NumberSpec";class he extends pe{valid(e){return(0,h.isNumber)(e)&&e>=0}}r.ScreenSizeSpec=he,he.__name__="ScreenSizeSpec";class me extends K{materialize(e){return(0,S.encode_rgba)((0,S.color2rgba)(e))}v_materialize(e){if(!(0,y.is_NDArray)(e))return this._from_css_array(e);if("uint32"==e.dtype&&1==e.dimension)return(0,p.to_big_endian)(e);if("uint8"==e.dtype&&1==e.dimension){const[t]=e.shape,r=new o.RGBAArray(4*t);let n=0;for(const t of e)r[n++]=t,r[n++]=t,r[n++]=t,r[n++]=255;return new o.ColorArray(r.buffer)}if("uint8"==e.dtype&&2==e.dimension){const[t,r]=e.shape;if(4==r)return new o.ColorArray(e.buffer);if(3==r){const n=new o.RGBAArray(4*t);for(let a=0,s=0;a0)return e in i?i[e]:i[e]=new _(e,l);throw new TypeError("Logger.get() expects a non-empty string name and an optional log-level")}constructor(e,l=_.INFO){this._name=e,this.set_level(l)}get level(){return this.get_level()}get_level(){return this._log_level}set_level(e){if(e instanceof v)this._log_level=e;else{if(!_.log_levels.hasOwnProperty(e))throw new Error("Logger.set_level() expects a log-level object or a string name of a log-level");this._log_level=_.log_levels[e]}const l=`[${this._name}]`;for(const{level:e,method:o}of(0,r.values)(_.log_levels))e","*"),o.BuiltinFormatter=(0,a.Enum)("raw","basic","numeral","printf","datetime"),o.HTTPMethod=(0,a.Enum)("POST","GET"),o.HexTileOrientation=(0,a.Enum)("pointytop","flattop"),o.HoverMode=(0,a.Enum)("mouse","hline","vline"),o.ImageOrigin=(0,a.Enum)("bottom_left","top_left","bottom_right","top_right"),o.LatLon=(0,a.Enum)("lat","lon"),o.LegendClickPolicy=(0,a.Enum)("none","hide","mute"),o.LegendLocation=o.Anchor,o.LineCap=(0,a.Enum)("butt","round","square"),o.LineDash=(0,a.Enum)("solid","dashed","dotted","dotdash","dashdot"),o.LineJoin=(0,a.Enum)("miter","round","bevel"),o.LinePolicy=(0,a.Enum)("prev","next","nearest","interp","none"),o.Location=(0,a.Enum)("above","below","left","right"),o.Logo=(0,a.Enum)("normal","grey"),o.MapType=(0,a.Enum)("satellite","roadmap","terrain","hybrid"),o.MarkerType=(0,a.Enum)("asterisk","circle","circle_cross","circle_dot","circle_x","circle_y","cross","dash","diamond","diamond_cross","diamond_dot","dot","hex","hex_dot","inverted_triangle","plus","square","square_cross","square_dot","square_pin","square_x","star","star_dot","triangle","triangle_dot","triangle_pin","x","y"),o.MutedPolicy=(0,a.Enum)("show","ignore"),o.Orientation=(0,a.Enum)("vertical","horizontal"),o.OutlineShapeName=(0,a.Enum)("none","box","rectangle","square","circle","ellipse","trapezoid","parallelogram","diamond","triangle"),o.OutputBackend=(0,a.Enum)("canvas","svg","webgl"),o.PaddingUnits=(0,a.Enum)("percent","absolute"),o.PanDirection=(0,a.Enum)("left","right","up","down","west","east","north","south"),o.Place=(0,a.Enum)("above","below","left","right","center"),o.PointPolicy=(0,a.Enum)("snap_to_data","follow_mouse","none"),o.RadiusDimension=(0,a.Enum)("x","y","max","min"),o.RenderLevel=(0,a.Enum)("image","underlay","glyph","guide","annotation","overlay"),o.ResetPolicy=(0,a.Enum)("standard","event_only"),o.ResolutionType=(0,a.Enum)("microseconds","milliseconds","seconds","minsec","minutes","hourmin","hours","days","months","years"),o.RoundingFunction=(0,a.Enum)("round","nearest","floor","rounddown","ceil","roundup"),o.ScrollbarPolicy=(0,a.Enum)("auto","visible","hidden"),o.RegionSelectionMode=(0,a.Enum)("replace","append","intersect","subtract","xor"),o.SelectionMode=(0,a.Enum)(...o.RegionSelectionMode,"toggle"),o.Side=(0,a.Enum)("above","below","left","right"),o.SizingMode=(0,a.Enum)("stretch_width","stretch_height","stretch_both","scale_width","scale_height","scale_both","fixed","inherit"),o.Sort=(0,a.Enum)("ascending","descending"),o.SpatialUnits=(0,a.Enum)("screen","data"),o.StartEnd=(0,a.Enum)("start","end"),o.StepMode=(0,a.Enum)("after","before","center"),o.TapBehavior=(0,a.Enum)("select","inspect"),o.TapGesture=(0,a.Enum)("tap","doubletap"),o.TextAlign=(0,a.Enum)("left","right","center"),o.TextBaseline=(0,a.Enum)("top","middle","bottom","alphabetic","hanging","ideographic"),o.TextureRepetition=(0,a.Enum)("repeat","repeat_x","repeat_y","no_repeat"),o.LabelOrientation=(0,a.Enum)("vertical","horizontal","parallel","normal"),o.TooltipAttachment=(0,a.Enum)("horizontal","vertical","left","right","above","below"),o.UpdateMode=(0,a.Enum)("replace","append"),o.VerticalAlign=(0,a.Enum)("top","middle","bottom"),o.WindowAxis=(0,a.Enum)("none","x","y"),o.ToolIcon=(0,a.Enum)("append_mode","arrow_down_to_bar","arrow_up_from_bar","auto_box_zoom","bold","box_edit","box_select","box_zoom","caret_down","caret_left","caret_right","caret_up","check","chevron_down","chevron_left","chevron_right","chevron_up","clear_selection","copy","crosshair","dark_theme","delete","freehand_draw","fullscreen","help","hover","intersect_mode","invert_selection","italic","lasso_select","light_theme","line_edit","maximize","minimize","pan","pin","point_draw","pointer","poly_draw","poly_edit","polygon_select","range","redo","replace_mode","reset","save","see_off","see_on","settings","square","square_check","subtract_mode","tap_select","text_align_center","text_align_left","text_align_right","undo","unknown","unpin","wheel_pan","wheel_zoom","x_box_select","x_box_zoom","x_grip","x_pan","xor_mode","y_box_select","y_box_zoom","y_grip","y_pan","zoom_in","zoom_out"),o.ToolName=(0,a.Enum)("auto_box_zoom","box_select","box_zoom","click","copy","crosshair","doubletap","examine","freehand_draw","fullscreen","help","hover","lasso_select","pan","pan_down","pan_east","pan_left","pan_north","pan_right","pan_south","pan_up","pan_west","poly_select","redo","reset","save","tap","undo","wheel_zoom","xbox_select","xbox_zoom","xcrosshair","xpan","xwheel_pan","xwheel_zoom","xzoom_in","xzoom_out","ybox_select","ybox_zoom","ycrosshair","ypan","ywheel_pan","ywheel_zoom","yzoom_in","yzoom_out","zoom_in","zoom_out")},
+function _(e,o,n,t,i){t(),n.ToolName=n.ToolIcon=n.WindowAxis=n.VerticalAlign=n.UpdateMode=n.TooltipAttachment=n.LabelOrientation=n.TimedeltaResolutionType=n.TextureRepetition=n.TextBaseline=n.TextAlign=n.TapGesture=n.TapBehavior=n.StepMode=n.StartEnd=n.SpatialUnits=n.Sort=n.SizingMode=n.Side=n.SelectionMode=n.RegionSelectionMode=n.ScrollbarPolicy=void 0;const a=e(22);n.Align=(0,a.Enum)("start","center","end"),n.HAlign=(0,a.Enum)("left","center","right"),n.VAlign=(0,a.Enum)("top","center","bottom"),n.Anchor=(0,a.Enum)("top_left","top_center","top_right","center_left","center_center","center_right","bottom_left","bottom_center","bottom_right","top","left","center","right","bottom"),n.AngleUnits=(0,a.Enum)("deg","rad","grad","turn"),n.AlternationPolicy=(0,a.Enum)("none","even","odd","every"),n.AxisLabelStandoffMode=(0,a.Enum)("tick_labels","axis"),n.BoxOrigin=(0,a.Enum)("corner","center"),n.ButtonType=(0,a.Enum)("default","primary","success","warning","danger","light"),n.CalendarPosition=(0,a.Enum)("auto","above","below"),n.Clock=(0,a.Enum)("12h","24h"),n.CoordinateUnits=(0,a.Enum)("canvas","screen","data"),n.ContextWhich=(0,a.Enum)("start","center","end","all"),n.Dimension=(0,a.Enum)("width","height"),n.Dimensions=(0,a.Enum)("width","height","both"),n.Direction=(0,a.Enum)("clock","anticlock"),n.Distribution=(0,a.Enum)("uniform","normal"),n.Face=(0,a.Enum)("front","back"),n.FlowMode=(0,a.Enum)("block","inline"),n.FontStyle=(0,a.Enum)("normal","italic","bold","bold italic"),n.HatchPatternType=(0,a.Enum)("blank","dot","ring","horizontal_line","vertical_line","cross","horizontal_dash","vertical_dash","spiral","right_diagonal_line","left_diagonal_line","diagonal_cross","right_diagonal_dash","left_diagonal_dash","horizontal_wave","vertical_wave","criss_cross"," ",".","o","-","|","+",'"',":","@","/","\\","x",",","`","v",">","*"),n.BuiltinFormatter=(0,a.Enum)("raw","basic","numeral","printf","datetime"),n.HTTPMethod=(0,a.Enum)("POST","GET"),n.HexTileOrientation=(0,a.Enum)("pointytop","flattop"),n.HoverMode=(0,a.Enum)("mouse","hline","vline"),n.ImageOrigin=(0,a.Enum)("bottom_left","top_left","bottom_right","top_right"),n.LatLon=(0,a.Enum)("lat","lon"),n.LegendClickPolicy=(0,a.Enum)("none","hide","mute"),n.LegendLocation=n.Anchor,n.LineCap=(0,a.Enum)("butt","round","square"),n.LineDash=(0,a.Enum)("solid","dashed","dotted","dotdash","dashdot"),n.LineJoin=(0,a.Enum)("miter","round","bevel"),n.LinePolicy=(0,a.Enum)("prev","next","nearest","interp","none"),n.Location=(0,a.Enum)("above","below","left","right"),n.Logo=(0,a.Enum)("normal","grey"),n.MapType=(0,a.Enum)("satellite","roadmap","terrain","hybrid"),n.MarkerType=(0,a.Enum)("asterisk","circle","circle_cross","circle_dot","circle_x","circle_y","cross","dash","diamond","diamond_cross","diamond_dot","dot","hex","hex_dot","inverted_triangle","plus","square","square_cross","square_dot","square_pin","square_x","star","star_dot","triangle","triangle_dot","triangle_pin","x","y"),n.MutedPolicy=(0,a.Enum)("show","ignore"),n.Orientation=(0,a.Enum)("vertical","horizontal"),n.OutlineShapeName=(0,a.Enum)("none","box","rectangle","square","circle","ellipse","trapezoid","parallelogram","diamond","triangle"),n.OutputBackend=(0,a.Enum)("canvas","svg","webgl"),n.PaddingUnits=(0,a.Enum)("percent","absolute"),n.PanDirection=(0,a.Enum)("left","right","up","down","west","east","north","south"),n.Place=(0,a.Enum)("above","below","left","right","center"),n.PointPolicy=(0,a.Enum)("snap_to_data","follow_mouse","none"),n.RadiusDimension=(0,a.Enum)("x","y","max","min"),n.RenderLevel=(0,a.Enum)("image","underlay","glyph","guide","annotation","overlay"),n.ResetPolicy=(0,a.Enum)("standard","event_only"),n.ResolutionType=(0,a.Enum)("microseconds","milliseconds","seconds","minsec","minutes","hourmin","hours","days","months","years"),n.RoundingFunction=(0,a.Enum)("round","nearest","floor","rounddown","ceil","roundup"),n.ScrollbarPolicy=(0,a.Enum)("auto","visible","hidden"),n.RegionSelectionMode=(0,a.Enum)("replace","append","intersect","subtract","xor"),n.SelectionMode=(0,a.Enum)(...n.RegionSelectionMode,"toggle"),n.Side=(0,a.Enum)("above","below","left","right"),n.SizingMode=(0,a.Enum)("stretch_width","stretch_height","stretch_both","scale_width","scale_height","scale_both","fixed","inherit"),n.Sort=(0,a.Enum)("ascending","descending"),n.SpatialUnits=(0,a.Enum)("screen","data"),n.StartEnd=(0,a.Enum)("start","end"),n.StepMode=(0,a.Enum)("after","before","center"),n.TapBehavior=(0,a.Enum)("select","inspect"),n.TapGesture=(0,a.Enum)("tap","doubletap"),n.TextAlign=(0,a.Enum)("left","right","center"),n.TextBaseline=(0,a.Enum)("top","middle","bottom","alphabetic","hanging","ideographic"),n.TextureRepetition=(0,a.Enum)("repeat","repeat_x","repeat_y","no_repeat"),n.TimedeltaResolutionType=(0,a.Enum)("nanoseconds","microseconds","milliseconds","seconds","minsec","minutes","hourmin","hours","days"),n.LabelOrientation=(0,a.Enum)("vertical","horizontal","parallel","normal"),n.TooltipAttachment=(0,a.Enum)("horizontal","vertical","left","right","above","below"),n.UpdateMode=(0,a.Enum)("replace","append"),n.VerticalAlign=(0,a.Enum)("top","middle","bottom"),n.WindowAxis=(0,a.Enum)("none","x","y"),n.ToolIcon=(0,a.Enum)("append_mode","arrow_down_to_bar","arrow_up_from_bar","auto_box_zoom","bold","box_edit","box_select","box_zoom","caret_down","caret_left","caret_right","caret_up","check","chevron_down","chevron_left","chevron_right","chevron_up","clear_selection","copy","crosshair","dark_theme","delete","freehand_draw","fullscreen","help","hover","intersect_mode","invert_selection","italic","lasso_select","light_theme","line_edit","maximize","minimize","pan","pin","point_draw","pointer","poly_draw","poly_edit","polygon_select","range","redo","replace_mode","reset","save","see_off","see_on","settings","square","square_check","subtract_mode","tap_select","text_align_center","text_align_left","text_align_right","undo","unknown","unpin","wheel_pan","wheel_zoom","x_box_select","x_box_zoom","x_grip","x_pan","xor_mode","y_box_select","y_box_zoom","y_grip","y_pan","zoom_in","zoom_out"),n.ToolName=(0,a.Enum)("auto_box_zoom","box_select","box_zoom","click","copy","crosshair","doubletap","examine","freehand_draw","fullscreen","help","hover","lasso_select","pan","pan_down","pan_east","pan_left","pan_north","pan_right","pan_south","pan_up","pan_west","poly_select","redo","reset","save","tap","undo","wheel_zoom","xbox_select","xbox_zoom","xcrosshair","xpan","xwheel_pan","xwheel_zoom","xzoom_in","xzoom_out","ybox_select","ybox_zoom","ycrosshair","ypan","ywheel_pan","ywheel_zoom","yzoom_in","yzoom_out","zoom_in","zoom_out")},
function _(t,e,r,n,s){n();const i=t(1).__importStar(t(8)),a=t(23),_=t(9),o=t(18),u=globalThis.Map,l=globalThis.Set,y=globalThis.Node;class d{}r.Kind=d,d.__name__="Kind",function(t){class e extends d{may_have_refs(){return!1}}e.__name__="Primitive",t.Primitive=e;class r extends e{valid(t){return void 0!==t}toString(){return"Any"}may_have_refs(){return!0}}r.__name__="Any",t.Any=r;class n extends e{valid(t){return void 0!==t}toString(){return"Unknown"}may_have_refs(){return!0}}n.__name__="Unknown",t.Unknown=n;class s extends e{valid(t){return i.isBoolean(t)}toString(){return"Bool"}}s.__name__="Bool",t.Bool=s;class c extends d{constructor(t){super(),this.obj_type=t}valid(t){return t instanceof this.obj_type}toString(){const t=this.obj_type;return`Ref(${t.__name__??t.toString()})`}may_have_refs(){const{obj_type:t}=this;return!(o.has_refs in t)||t[o.has_refs]}}c.__name__="Ref",t.Ref=c;class p extends d{valid(t){return i.isObject(t)}toString(){return"AnyRef"}may_have_refs(){return!0}}p.__name__="AnyRef",t.AnyRef=p;class h extends e{valid(t){return i.isNumber(t)}toString(){return"Float"}}h.__name__="Float",t.Float=h;class m extends h{valid(t){return super.valid(t)&&i.isInteger(t)}toString(){return"Int"}}m.__name__="Int",t.Int=m;class v extends h{valid(t){return super.valid(t)&&0<=t&&t<=1}toString(){return"Percent"}}v.__name__="Percent",t.Percent=v;class f extends d{constructor(t){super(),this.types=t,this.types=t}valid(t){return this.types.some((e=>e.valid(t)))}toString(){return`Or(${this.types.map((t=>t.toString())).join(", ")})`}may_have_refs(){return this.types.some((t=>t.may_have_refs()))}}f.__name__="Or",t.Or=f;class S extends d{constructor(t,e){super(),this.types=[t,e]}valid(t){return this.types.some((e=>e.valid(t)))}toString(){return`And(${this.types.map((t=>t.toString())).join(", ")})`}may_have_refs(){return this.types.some((t=>t.may_have_refs()))}}S.__name__="And",t.And=S;class g extends d{constructor(t){super(),this.types=t,this.types=t}valid(t){if(!i.isArray(t))return!1;for(let e=0;et.toString())).join(", ")})`}may_have_refs(){return this.types.some((t=>t.may_have_refs()))}}g.__name__="Tuple",t.Tuple=g;class x extends d{constructor(t){super(),this.struct_type=t}valid(t){if(!i.isPlainObject(t))return!1;const e=new _.PlainObjectProxy(this.struct_type);for(const r of(0,_.keys)(t))if(!e.has(r))return!1;for(const[r,n]of e){const e=t[r];if(!n.valid(e))return!1}return!0}toString(){return`Struct({${(0,_.typed_entries)(this.struct_type).map((([t,e])=>`${t.toString()}: ${e}`)).join(", ")}})`}may_have_refs(){return(0,_.typed_values)(this.struct_type).some((t=>t.may_have_refs()))}}x.__name__="Struct",t.Struct=x;class b extends d{constructor(t){super(),this.struct_type=t}valid(t){if(!i.isPlainObject(t))return!1;const e=new _.PlainObjectProxy(t),r=new _.PlainObjectProxy(this.struct_type);for(const t of e.keys())if(!r.has(t))return!1;for(const[t,n]of r){const r=e.get(t);if(void 0!==r&&!n.valid(r))return!1}return!0}toString(){return`Struct({${(0,_.typed_entries)(this.struct_type).map((([t,e])=>`${t.toString()}?: ${e}`)).join(", ")}})`}may_have_refs(){return(0,_.typed_values)(this.struct_type).some((t=>t.may_have_refs()))}}b.__name__="PartialStruct",t.PartialStruct=b;class w extends d{constructor(t){super(),this.item_type=t}valid(t){return i.isIterable(t)}toString(){return`Iterable(${this.item_type.toString()})`}may_have_refs(){return this.item_type.may_have_refs()}}w.__name__="Iterable",t.Iterable=w;class K extends d{constructor(t){super(),this.item_type=t}valid(t){return i.isArray(t)||i.isTypedArray(t)}toString(){return`Arrayable(${this.item_type.toString()})`}may_have_refs(){return this.item_type.may_have_refs()}}K.__name__="Arrayable",t.Arrayable=K;class N extends d{constructor(t){super(),this.item_type=t}valid(t){return i.isArray(t)&&t.every((t=>this.item_type.valid(t)))}toString(){return`List(${this.item_type.toString()})`}may_have_refs(){return this.item_type.may_have_refs()}}N.__name__="List",t.List=N;class P extends N{valid(t){return super.valid(t)&&0!=t.length}toString(){return`NonEmptyList(${this.item_type.toString()})`}}P.__name__="NonEmptyList",t.NonEmptyList=P;class A extends e{valid(t){return null===t}toString(){return"Null"}}A.__name__="Null",t.Null=A;class $ extends d{constructor(t){super(),this.base_type=t}valid(t){return null===t||this.base_type.valid(t)}toString(){return`Nullable(${this.base_type.toString()})`}may_have_refs(){return this.base_type.may_have_refs()}}$.__name__="Nullable",t.Nullable=$;class j extends d{constructor(t){super(),this.base_type=t}valid(t){return void 0===t||this.base_type.valid(t)}toString(){return`Opt(${this.base_type.toString()})`}may_have_refs(){return this.base_type.may_have_refs()}}j.__name__="Opt",t.Opt=j;class F extends d{valid(t){return t instanceof ArrayBuffer}toString(){return"Bytes"}may_have_refs(){return!1}}F.__name__="Bytes",t.Bytes=F;class O extends e{valid(t){return i.isString(t)}toString(){return"Str"}}O.__name__="Str",t.Str=O;class L extends e{constructor(t){super(),this.prefix=t}valid(t){return i.isString(t)&&t.startsWith(this.prefix)}toString(){return`PrefixedStr('${this.prefix}')`}}L.__name__="PrefixedStr",t.PrefixedStr=L;class k extends O{constructor(t){super(),this.regex=t}valid(t){return super.valid(t)&&this.regex.test(t)}toString(){return`Regex(${this.regex.toString()})`}}k.__name__="Regex",t.Regex=k;class R extends e{constructor(t){super(),this.values=new l(t)}valid(t){return this.values.has(t)}*[Symbol.iterator](){yield*this.values}toString(){return`Enum(${[...this.values].map((t=>t.toString())).join(", ")})`}}R.__name__="Enum",t.Enum=R;class B extends d{constructor(t){super(),this.item_type=t}valid(t){if(!(t instanceof u||i.isPlainObject(t)))return!1;for(const e of(0,_.values)(t))if(!this.item_type.valid(e))return!1;return!0}toString(){return`Dict(${this.item_type.toString()})`}may_have_refs(){return this.item_type.may_have_refs()}}B.__name__="Dict",t.Dict=B;class I extends d{constructor(t,e){super(),this.key_type=t,this.item_type=e}valid(t){if(!(t instanceof u||i.isPlainObject(t)))return!1;for(const[e,r]of(0,_.entries)(t))if(!this.key_type.valid(e)||!this.item_type.valid(r))return!1;return!0}toString(){return`KeyVal(${this.key_type.toString()}, ${this.item_type.toString()})`}may_have_refs(){return this.key_type.may_have_refs()||this.item_type.may_have_refs()}}I.__name__="KeyVal",t.KeyVal=I;class C extends d{constructor(t,e){super(),this.key_type=t,this.item_type=e}coerce(t){return i.isPlainObject(t)&&(0,_.is_empty)(t)?new u:t}valid(t){if(!(t instanceof u))return!1;for(const[e,r]of t.entries())if(!this.key_type.valid(e)||!this.item_type.valid(r))return!1;return!0}toString(){return`Mapping(${this.key_type.toString()}, ${this.item_type.toString()})`}may_have_refs(){return this.key_type.may_have_refs()||this.item_type.may_have_refs()}}C.__name__="Mapping",t.Mapping=C;class E extends d{constructor(t){super(),this.item_type=t}valid(t){if(!(t instanceof l))return!1;for(const e of t)if(!this.item_type.valid(e))return!1;return!0}toString(){return`Set(${this.item_type.toString()})`}may_have_refs(){return this.item_type.may_have_refs()}}E.__name__="Set",t.Set=E;class T extends d{valid(t){return(0,a.is_Color)(t)}toString(){return"Color"}may_have_refs(){return!1}}T.__name__="Color",t.Color=T;class M extends O{toString(){return"CSSLength"}}M.__name__="CSSLength",t.CSSLength=M;class D extends d{constructor(t,e){super(),this.args_types=t,this.ret_type=e}valid(t){return i.isFunction(t)}toString(){const{args_types:t,ret_type:e}=this;return`Func((${null==t?"?":t.map((t=>t.toString())).join(", ")}), ${null==e?"?":e.toString()})`}may_have_refs(){return!1}}D.__name__="Func",t.Func=D;class U extends d{constructor(t){super(),this.base_type=t}valid(t){return this.base_type.valid(t)&&t>=0}toString(){return`NonNegative(${this.base_type.toString()})`}may_have_refs(){return this.base_type.may_have_refs()}}U.__name__="NonNegative",t.NonNegative=U;class V extends d{constructor(t){super(),this.base_type=t}valid(t){return this.base_type.valid(t)&&t>0}toString(){return`Positive(${this.base_type.toString()})`}may_have_refs(){return this.base_type.may_have_refs()}}V.__name__="Positive",t.Positive=V;class z extends d{valid(t){return t instanceof y}toString(){return"Node"}may_have_refs(){return!1}}z.__name__="Node",t.Node=z}(r.Kinds||(r.Kinds={})),r.Any=new r.Kinds.Any,r.Unknown=new r.Kinds.Unknown,r.Bool=new r.Kinds.Bool,r.Float=new r.Kinds.Float,r.Int=new r.Kinds.Int,r.Bytes=new r.Kinds.Bytes,r.Str=new r.Kinds.Str;r.PrefixedStr=t=>new r.Kinds.PrefixedStr(t);r.Regex=t=>new r.Kinds.Regex(t),r.Null=new r.Kinds.Null;r.Nullable=t=>new r.Kinds.Nullable(t);r.Opt=t=>new r.Kinds.Opt(t);r.Or=(...t)=>new r.Kinds.Or(t);r.And=(t,e)=>new r.Kinds.And(t,e);r.Tuple=(...t)=>new r.Kinds.Tuple(t);r.Struct=t=>new r.Kinds.Struct(t);r.PartialStruct=t=>new r.Kinds.PartialStruct(t);r.Iterable=t=>new r.Kinds.Iterable(t);r.Arrayable=t=>new r.Kinds.Arrayable(t);r.List=t=>new r.Kinds.List(t);r.NonEmptyList=t=>new r.Kinds.NonEmptyList(t);r.Dict=t=>new r.Kinds.Dict(t);r.KeyVal=(t,e)=>new r.Kinds.KeyVal(t,e);r.Mapping=(t,e)=>new r.Kinds.Mapping(t,e);r.Set=t=>new r.Kinds.Set(t);r.Enum=(...t)=>new r.Kinds.Enum(t);r.Ref=t=>new r.Kinds.Ref(t);r.AnyRef=()=>new r.Kinds.AnyRef;r.Func=(t,e)=>new r.Kinds.Func(t,e);r.Func0=t=>new r.Kinds.Func([],t),r.Node=new r.Kinds.Node;r.NonNegative=t=>new r.Kinds.NonNegative(t);r.Positive=t=>new r.Kinds.Positive(t),r.Percent=new r.Kinds.Percent,r.Alpha=r.Percent,r.Color=new r.Kinds.Color,r.Auto=(0,r.Enum)("auto"),r.CSSLength=new r.Kinds.CSSLength,r.FontSize=r.Str,r.Font=r.Str,r.Angle=r.Float,r.Boolean=r.Bool,r.String=r.Str,r.Number=r.Float,r.Array=r.List,r.Map=r.Mapping,r.Function=r.Func},
function _(n,r,t,e,s){e(),t.byte=a,t.transparent=f,t.encode_rgba=function([n,r,t,e]){return n<<24|r<<16|t<<8|e},t.decode_rgba=g,t.color2rgba=b,t.rgba2css=$,t.color2css=function(n,r){if(!(0,c.isString)(n)||null!=r&&1!=r){const[t,e,s,u]=b(n,r);return $([t,e,s,u])}return n},t.color2hex=function(n,r){const[t,e,s,u]=b(n,r),i=`#${d(t)}${d(e)}${d(s)}`;return 255==u?i:`${i}${d(u)}`},t.color2hexrgb=function(n){const[r,t,e]=b(n);return`#${d(r)}${d(t)}${d(e)}`},t.css4_parse=p,t.is_Color=function(n){if((0,c.isInteger)(n))return!0;if((0,c.isString)(n)&&null!=p(n))return!0;if((0,c.isArray)(n)&&(3==n.length||4==n.length))return!0;return!1},t.is_dark=function([n,r,t]){return 1-(.299*n+.587*r+.114*t)/255>=.6},t.brightness=function(n){const[r,t,e]=b(n);return l(.299*r**2+.587*t**2+.114*e**2)/255},t.luminance=function(n){const[r,t,e]=b(n);return(.2126*r**2.2+.7152*t**2.2+.0722*e**2.2)/255**2.2};const u=n(24),i=n(11),c=n(8),{round:o,sqrt:l}=Math;function a(n){return(0,i.clamp)(o(n),0,255)}function f(){return[0,0,0,0]}function g(n){return[n>>24&255,n>>16&255,n>>8&255,255&n]}function b(n,r=1){const[t,e,s,u]=(()=>{if(null==n)return[0,0,0,0];if((0,c.isInteger)(n))return g(n);if((0,c.isString)(n)){const[r,t,e,s]=p(n)??[0,0,0,0];return[r,t,e,a(255*s)]}if(2==n.length){const[r,t]=n;return b(r,t)}{const[r,t,e,s=1]=n;return[r,t,e,a(255*s)]}})();return[t,e,s,a(r*u)]}const h={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"a",11:"b",12:"c",13:"d",14:"e",15:"f"};function d(n){return h[n>>4]+h[15&n]}function $([n,r,t,e]){return`rgb(${n} ${r} ${t}${255==e?"":" / "+e/255})`}const m=/^rgba?\(\s*(?[^\s,]+?)\s+(?[^\s,]+?)\s+(?[^\s,]+?)(?:\s*\/\s*(?[^\s,]+?))?\s*\)$/,N=/^rgba?\(\s*(?[^\s,]+?)\s*,\s*(?[^\s,]+?)\s*,\s*(?[^\s,]+?)(?:\s*,\s*(?[^\s,]+?))?\s*\)$/,_=(()=>{const n=document.createElement("canvas");n.width=1,n.height=1;const r=n.getContext("2d"),t=r.createLinearGradient(0,0,1,1);return n=>{r.fillStyle=t,r.fillStyle=n;const e=r.fillStyle;return e!=t?e:null}})();function p(n){if(""==(n=n.trim().toLowerCase()))return null;if("transparent"==n)return[0,0,0,0];if((0,u.is_named_color)(n)){const[r,t,e,s]=g(u.named_colors[n]);return[r,t,e,s/255]}if("#"==n[0]){const r=Number(`0x${n.substring(1)}`);if(isNaN(r))return null;switch(n.length-1){case 3:{const n=r>>8&15,t=r>>4&15,e=15&r;return[n<<4|n,t<<4|t,e<<4|e,1]}case 4:{const n=r>>12&15,t=r>>8&15,e=r>>4&15,s=15&r;return[n<<4|n,t<<4|t,e<<4|e,(s<<4|s)/255]}case 6:return[r>>16&255,r>>8&255,255&r,1];case 8:return[r>>24&255,r>>16&255,r>>8&255,(255&r)/255]}}else if(n.startsWith("rgb")){const r=n.match(m)??n.match(N);if(null!=r?.groups){let{r:n,g:t,b:e,a:s="1"}=r.groups;const u=n.endsWith("%"),i=t.endsWith("%"),c=e.endsWith("%"),o=s.endsWith("%");if(!(u&&i&&c)&&(u||i||c))return null;u&&(n=n.slice(0,-1)),i&&(t=t.slice(0,-1)),c&&(e=e.slice(0,-1)),o&&(s=s.slice(0,-1));let l=Number(n),f=Number(t),g=Number(e),b=Number(s);return isNaN(l+f+g+b)?null:(u&&(l=l/100*255),i&&(f=f/100*255),c&&(g=g/100*255),b=o?b/100:b,l=a(l),f=a(f),g=a(g),[l,f,g,b])}}else{const r=_(n);if(null!=r)return p(r)}return null}},
function _(e,r,l,a,i){a(),l.is_named_color=function(e){return e in l.named_colors};l.named_colors={aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199}},
function _(r,t,n,o,a){o(),n.infer_type=function(r,t){if(r instanceof Float64Array||r instanceof Array)return Float64Array;if(t instanceof Float64Array||t instanceof Array)return Float64Array;return Float32Array},n.to_screen=function(r){return r instanceof Float32Array?r:Float32Array.from(r)},n.GeneratorFunction=Object.getPrototypeOf((function*(){})).constructor,n.AsyncGeneratorFunction=Object.getPrototypeOf((async function*(){})).constructor,n.ColorArray=Uint32Array,n.RGBAArray=Uint8ClampedArray,n.ScreenArray=Float32Array,a("Indices",r(26).BitSet)},
-function _(t,s,r,e,i){var n,o;e();const _=t(27),a=t(12),h=t(18);class c{constructor(t,s=0){this[n]="BitSet",this._count=null,this.size=t,this._nwords=Math.ceil(t/c._word_length),0==s||1==s?(this._array=new Uint32Array(this._nwords),1==s&&this._array.fill(4294967295)):((0,a.assert)(s.length==this._nwords,"Initializer size mismatch"),this._array=s)}clone(){return new c(this.size,new Uint32Array(this._array))}[(n=Symbol.toStringTag,o=h.has_refs,_.equals)](t,s){if(!s.eq(this.size,t.size))return!1;const{_nwords:r}=this,e=this.size%c._word_length,i=0==e?r:r-1;for(let s=0;s>>5,r=31&t;return 1==(this._array[s]>>r&1)}set(t,s=!0){this._check_bounds(t),this._count=null;const r=t>>>5,e=31&t;s?this._array[r]|=1<>>t&1)&&(e+=1)}return e}*ones(){const{_array:t,_nwords:s,size:r}=this;for(let e=0,i=0;i>>t&1)&&(yield e);else e+=c._word_length}}*zeros(){const{_array:t,_nwords:s,size:r}=this;for(let e=0,i=0;i>>t&1||(yield e);else e+=c._word_length}}_check_size(t){(0,a.assert)(this.size==t.size,`Size mismatch (${this.size} != ${t.size})`)}invert(){for(let t=0;t>>0}add(t){this._check_size(t);for(let s=0;s>>5,s=31&t;return 1==(this._array[e]>>s&1)}set_unchecked(t,e=!0){this._count=null;const s=t>>>5,r=31&t;e?this._array[s]|=1<=0?t:s+t} >= size=${s}`)}unset(t){this.set(t,!1)}*[Symbol.iterator](){yield*this.ones()}get count(){let t=this._count;return null==t&&(this._count=t=this._get_count()),t}_get_count(){const{_array:t,_nwords:e,size:s}=this;let r=0;for(let n=0,i=0;i>>t&1)&&(r+=1)}return r}ones(){const t=new Array(this.count);let e=0;const{_array:s,_nwords:r,size:n}=this;for(let i=0,o=0;o>>s&1)&&(t[e++]=i);else i+=l._word_length}return t}zeros(){const t=new Array(this.count);let e=0;const{_array:s,_nwords:r,size:n}=this;for(let i=0,o=0;o>>s&1||(t[e++]=i);else i+=l._word_length}return t}_check_size(t){(0,_.assert)(this.size==t.size,`Size mismatch (${this.size} != ${t.size})`)}invert(){for(let t=0;t>>0}add(t){this._check_size(t);for(let e=0;e0;)if(n[o]===t)return c[o]===e;n.push(t),c.push(e);const l=(()=>{if(a(t)&&a(e))return t[r.equals](e,this);switch(s){case"[object Array]":case"[object Uint8Array]":case"[object Int8Array]":case"[object Uint16Array]":case"[object Int16Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Float32Array]":case"[object Float64Array]":return this.arrays(t,e);case"[object ArrayBuffer]":case"[object SharedArrayBuffer]":return this.array_buffers(t,e);case"[object Map]":return this.maps(t,e);case"[object Set]":return this.sets(t,e);case"[object Object]":if(t.constructor==e.constructor&&(null==t.constructor||t.constructor===Object))return this.objects(t,e);case"[object Function]":if(t.constructor==e.constructor&&t.constructor===Function)return this.eq(`${t}`,`${e}`)}if("undefined"!=typeof Node&&t instanceof Node)return this.nodes(t,e);throw new u(`can't compare objects of type ${s}`)})();return n.pop(),c.pop(),l}numbers(t,e){return t===e||Object.is(t,e)}arrays(t,e){const{length:r}=t;if(r!=e.length)return!1;for(let s=0;s0,i.is_little_endian=(()=>{const n=new ArrayBuffer(4),t=new Uint8Array(n);new Uint32Array(n)[1]=168496141;let i=!0;return 10==t[4]&&11==t[5]&&12==t[6]&&13==t[7]&&(i=!1),i})(),i.BYTE_ORDER=i.is_little_endian?"little":"big"},
function _(n,i,r,t,e){t(),r.isValue=o,r.isField=s,r.isExpr=l,r.isVectorized=function(n){return o(n)||s(n)||l(n)};const u=n(8),f=n(9);function c(n,i){if(!(0,u.isPlainObject)(n))return!1;if(!(i in n))return!1;let r=(0,f.size)(n)-1;return"transform"in n&&(r-=1),"units"in n&&(r-=1),0==r}function o(n){return c(n,"value")}function s(n){return c(n,"field")}function l(n){return c(n,"expr")}},
function _(e,t,r,s,_){s();class i{constructor(){this._dev=!1,this._wireframe=!1,this._force_webgl=!1,this._force_fields=!1}set dev(e){this._dev=e}get dev(){return this._dev}set wireframe(e){this._wireframe=e}get wireframe(){return this._wireframe}set force_webgl(e){this._force_webgl=e}get force_webgl(){return this._force_webgl}set force_fields(e){this._force_fields=e}get force_fields(){return this._force_fields}}r.Settings=i,i.__name__="Settings",r.settings=new i},
function _(e,t,s,r,n){var a,i,h,u,o,l,c,p,y,_;r(),s.is_NDArray=O,s.ndarray=function(e,{dtype:t,shape:s}={}){null==t&&(t=(()=>{switch(!0){case e instanceof Uint8Array:return"uint8";case e instanceof Int8Array:return"int8";case e instanceof Uint16Array:return"uint16";case e instanceof Int16Array:return"int16";case e instanceof Uint32Array:return"uint32";case e instanceof Int32Array:return"int32";case e instanceof Float32Array:return"float32";case e instanceof Float64Array:return"float64";default:return(0,A.is_ArrayBufferLike)(e)?"float64":"object"}})());switch(t){case"bool":return new D(e,s);case"uint8":return new q(e,s);case"int8":return new b(e,s);case"uint16":return new U(e,s);case"int16":return new I(e,s);case"uint32":return new x(e,s);case"int32":return new z(e,s);case"float32":return new F(e,s);case"float64":return new j(e,s);case"object":return new B(e,s)}};const A=e(8),d=e(28),g=e(27),f=e(32),m=e(33),w=Symbol("__ndarray__");function N(e,t){return{type:"ndarray",array:t.encode("object"==e.dtype?Array.from(e):e.buffer),order:d.BYTE_ORDER,dtype:e.dtype,shape:e.shape}}class D extends Uint8Array{constructor(e,t){super(e),this[a]=!0,this.dtype="bool",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(a=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new D(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return 1==this[e]}}s.BoolNDArray=D,D.__name__="BoolNDArray";class q extends Uint8Array{constructor(e,t){super(e),this[i]=!0,this.dtype="uint8",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(i=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new q(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return this[e]}}s.Uint8NDArray=q,q.__name__="Uint8NDArray";class b extends Int8Array{constructor(e,t){super(e),this[h]=!0,this.dtype="int8",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(h=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new b(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return this[e]}}s.Int8NDArray=b,b.__name__="Int8NDArray";class U extends Uint16Array{constructor(e,t){super(e),this[u]=!0,this.dtype="uint16",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(u=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new U(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return this[e]}}s.Uint16NDArray=U,U.__name__="Uint16NDArray";class I extends Int16Array{constructor(e,t){super(e),this[o]=!0,this.dtype="int16",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(o=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new I(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return this[e]}}s.Int16NDArray=I,I.__name__="Int16NDArray";class x extends Uint32Array{constructor(e,t){super(e),this[l]=!0,this.dtype="uint32",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(l=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new x(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return this[e]}}s.Uint32NDArray=x,x.__name__="Uint32NDArray";class z extends Int32Array{constructor(e,t){super(e),this[c]=!0,this.dtype="int32",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(c=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new z(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return this[e]}}s.Int32NDArray=z,z.__name__="Int32NDArray";class F extends Float32Array{constructor(e,t){super(e),this[p]=!0,this.dtype="float32",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(p=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new F(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return this[e]}}s.Float32NDArray=F,F.__name__="Float32NDArray";class j extends Float64Array{constructor(e,t){super(e),this[y]=!0,this.dtype="float64",this.shape=t??(O(e)?e.shape:[this.length]),this.dimension=this.shape.length}[(y=w,g.equals)](e,t){return t.eq(this.shape,e.shape)&&t.arrays(this,e)}[f.clone](e){return new j(this,e.clone(this.shape))}[m.serialize](e){return N(this,e)}get(e){return this[e]}}s.Float64NDArray=j,j.__name__="Float64NDArray";class B extends Array{get shape(){return this._shape??[this.length]}get dimension(){return this.shape.length}constructor(e,t){const s=(0,A.is_ArrayBufferLike)(e)?new Float64Array(e):e;if(super((0,A.isNumber)(s)?s:s.length),this[_]=!0,this.dtype="object",!(0,A.isNumber)(s))for(let e=0;e[this.clone(n),this.clone(e)])));if(n instanceof Set)return new Set([...n].map((n=>this.clone(n))));throw new l(`${Object.prototype.toString.call(n)} is not cloneable`)}}t.Cloner=a,a.__name__="Cloner"},
-function _(r,e,i,a,f){a();const o=r(1);var l=r(34);f("Serializer",l.Serializer),f("SerializationError",l.SerializationError),f("serialize",l.serialize);var t=r(35);f("Buffer",t.Buffer),f("Base64Buffer",t.Base64Buffer),o.__exportStar(r(37),i)},
+function _(r,e,i,a,f){a();const o=r(1);var l=r(34);f("Serializer",l.Serializer),f("SerializationError",l.SerializationError),f("serialize",l.serialize);var t=r(35);f("Buffer",t.Buffer),f("Base64Buffer",t.Base64Buffer),o.__exportStar(r(38),i)},
function _(e,r,t,n,i){n();const s=e(12),a=e(9),c=e(8),o=e(14),u=e(28),l=e(35);t.serialize=Symbol("serialize");class f extends Error{}t.SerializationError=f,f.__name__="SerializationError";class y{constructor(e){this.value=e}to_json(){return JSON.stringify(this.value)}}y.__name__="Serialized";class d{constructor(e){this._circular=new WeakSet,this.binary=e?.binary??!1,this.include_defaults=e?.include_defaults??!1;const r=e?.references;this._references=null!=r?new Map(r):new Map}get_ref(e){return this._references.get(e)}add_ref(e,r){(0,s.assert)(!this._references.has(e)),this._references.set(e,r)}to_serializable(e){return new y(this.encode(e))}encode(e){const r=this.get_ref(e);if(null!=r)return r;if(!(0,c.isObject)(e))return this._encode(e);this._circular.has(e)&&this.error("circular reference"),this._circular.add(e);try{return this._encode(e)}finally{this._circular.delete(e)}}_encode(e){if(function(e){return(0,c.isObject)(e)&&t.serialize in e}(e))return e[t.serialize](this);if((0,c.isArray)(e)){const r=e.length,t=new Array(r);for(let n=0;n[this.encode(e),this.encode(r)]))]}}if(null===e||(0,c.isBoolean)(e)||(0,c.isString)(e))return e;if((0,c.isNumber)(e))return isNaN(e)?{type:"number",value:"nan"}:isFinite(e)?e:{type:"number",value:(e<0?"-":"+")+"inf"};if(e instanceof Date){return{type:"date",iso:e.toISOString()}}if(e instanceof Set)return 0==e.size?{type:"set"}:{type:"set",entries:[...(0,o.map)(e.values(),(e=>this.encode(e)))]};if(e instanceof Map)return 0==e.size?{type:"map"}:{type:"map",entries:[...(0,o.map)(e.entries(),(([e,r])=>[this.encode(e),this.encode(r)]))]};if((0,c.isSymbol)(e)&&null!=e.description)return{type:"symbol",name:e.description};throw new f(`${Object.prototype.toString.call(e)} is not serializable`)}encode_struct(e){const r={};for(const[t,n]of(0,a.entries)(e))void 0!==n&&(r[t]=this.encode(n));return r}error(e){throw new f(e)}_encode_typed_array(e){const r=this.encode(e.buffer),t=(()=>{switch(e.constructor){case Uint8Array:return"uint8";case Int8Array:return"int8";case Uint16Array:return"uint16";case Int16Array:return"int16";case Uint32Array:return"uint32";case Int32Array:return"int32";case Float32Array:return"float32";case Float64Array:return"float64";default:this.error(`can't serialize typed array of type '${e[Symbol.toStringTag]}'`)}})();return{type:"typed_array",array:r,order:u.BYTE_ORDER,dtype:t}}}t.Serializer=d,d.__name__="Serializer"},
function _(e,f,r,s,t){s();const u=e(36),_=e(27);class a{constructor(e){this.buffer=e}to_base64(){return(0,u.buffer_to_base64)(this.buffer)}[_.equals](e,f){return f.eq(this.buffer,e.buffer)}}r.Buffer=a,a.__name__="Buffer";class n extends a{toJSON(){return this.to_base64()}}r.Base64Buffer=n,n.__name__="Base64Buffer"},
-function _(t,n,e,r,o){r(),e.buffer_to_base64=function(t){const n=new Uint8Array(t),e=Array.from(n).map((t=>String.fromCharCode(t)));return btoa(e.join(""))},e.base64_to_buffer=function(t){const n=atob(t),e=n.length,r=new Uint8Array(e);for(let t=0,o=e;tString.fromCharCode(n)));return btoa(t.join(""))}function i(n){const t=atob(n),e=t.length,o=new Uint8Array(e);for(let n=0,r=e;n>4>7||(t[0]<<8|t[1])%31?Ut(t,n,r):Rt(t,n,r)},r.decompressSync=function(t,n){return 31==t[0]&&139==t[1]&&8==t[2]?$t(t,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?It(t,n):Wt(t,n)},r.strToU8=rn,r.strFromU8=en,r.zip=function(t,n,r){r||(r=n,n={});"function"!=typeof r&&O(7);var i={};Jt(t,"",i,n);var e=Object.keys(i),o=e.length,s=0,u=0,h=o,f=new Array(o),c=[],l=function(){for(var t=0;t65535&&M(O(11,0,1),null),S)if(g<16e4)try{M(null,Ct(a,h))}catch(t){M(t,null)}else c.push(At(a,h,M));else M(null,a)},g=0;g65535&&O(11);var y=c?Ct(h,f):h,m=y.length,b=J();b.p(h),i.push(V(f,{size:h.length,crc:b.d(),c:y,f:M,m:v,u:l!=s.length||v&&p.length!=d,o:e,compression:c})),e+=30+l+g+m,o+=76+2*(l+g)+(d||0)+m}for(var w=new a(o+22),z=e,k=o-e,S=0;S65558)return s(O(13,0,1),null),e;var h=pt(t,u+8);if(h){var f=h,c=vt(t,u+16),l=4294967295==c||65535==f;if(l){var p=vt(t,u-12);(l=101075792==vt(t,p))&&(f=h=vt(t,p+32),c=vt(t,p+48))}for(var v=n&&n.filter,d=function(n){var r=sn(t,c,l),u=r[0],f=r[1],p=r[2],d=r[3],g=r[4],y=r[5],m=an(t,y);c=g;var b=function(t,n){t?(e(),s(t,null)):(n&&(o[d]=n),--h||s(null,o))};if(!v||v({name:d,size:f,originalSize:p,compression:u}))if(u)if(8==u){var w=t.subarray(m,m+f);if(p<524288||f>.8*p)try{b(null,It(w,{out:new a(p)}))}catch(t){b(t,null)}else i.push(Ut(w,{size:p},b))}else b(O(14,"unknown compression type "+u,1),null);else b(null,E(t,m,m+f));else b(null,null)},g=0;g65558)&&O(13);var e=pt(t,i+8);if(!e)return{};var o=vt(t,i+16),s=4294967295==o||65535==e;if(s){var u=vt(t,i-12);(s=101075792==vt(t,u))&&(e=vt(t,u+32),o=vt(t,u+48))}for(var h=n&&n.filter,f=0;f>1|(21845&w)<<1;z=(61680&(z=(52428&z)>>2|(13107&z)<<2))>>4|(3855&z)<<4,b[w]=((65280&z)>>8|(255&z)<<8)>>1}var k=function(t,n,r){for(var i=t.length,e=0,o=new s(n);e>h]=f}else for(a=new s(i),e=0;e>15-t[e]);return a},S=new a(288);for(w=0;w<144;++w)S[w]=8;for(w=144;w<256;++w)S[w]=9;for(w=256;w<280;++w)S[w]=7;for(w=280;w<288;++w)S[w]=8;var M=new a(32);for(w=0;w<32;++w)M[w]=5;var x=k(S,9,0),A=k(S,9,1),C=k(M,5,0),T=k(M,5,1),D=function(t){for(var n=t[0],r=1;rn&&(n=t[r]);return n},U=function(t,n,r){var i=n/8|0;return(t[i]|t[i+1]<<8)>>(7&n)&r},I=function(t,n){var r=n/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&n)},F=function(t){return(t+7)/8|0},E=function(t,n,r){return(null==n||n<0)&&(n=0),(null==r||r>t.length)&&(r=t.length),new a(t.subarray(n,r))};r.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var Z=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],O=function(t,n,r){var i=new Error(n||Z[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,O),!r)throw i;return i},q=function(t,n,r,i){var e=t.length,o=i?i.length:0;if(!e||n.f&&!n.l)return r||new a(0);var s=!r,u=s||2!=n.i,l=n.i;s&&(r=new a(3*e));var p=function(t){var n=r.length;if(t>n){var i=new a(Math.max(2*n,t));i.set(r),r=i}},d=n.f||0,g=n.p||0,m=n.b||0,b=n.l,w=n.d,z=n.m,S=n.n,M=8*e;do{if(!b){d=U(t,g,1);var x=U(t,g+1,3);if(g+=3,!x){var C=t[(R=F(g)+4)-4]|t[R-3]<<8,Z=R+C;if(Z>e){l&&O(0);break}u&&p(m+C),r.set(t.subarray(R,Z),m),n.b=m+=C,n.p=g=8*Z,n.f=d;continue}if(1==x)b=A,w=T,z=9,S=5;else if(2==x){var q=U(t,g,31)+257,G=U(t,g+10,15)+4,L=q+U(t,g+5,31)+1;g+=14;for(var $=new a(L),j=new a(19),H=0;H>4)<16)$[H++]=R;else{var Y=0,_=0;for(16==R?(_=3+U(t,g,3),g+=2,Y=$[H-1]):17==R?(_=3+U(t,g,7),g+=3):18==R&&(_=11+U(t,g,127),g+=7);_--;)$[H++]=Y}}var J=$.subarray(0,q),K=$.subarray(q);z=D(J),S=D(K),b=k(J,z,1),w=k(K,S,1)}else O(1);if(g>M){l&&O(0);break}}u&&p(m+131072);for(var Q=(1<>4;if((g+=15&Y)>M){l&&O(0);break}if(Y||O(2),tt<256)r[m++]=tt;else{if(256==tt){X=g,b=null;break}var nt=tt-254;if(tt>264){var rt=h[H=tt-257];nt=U(t,g,(1<