UNPKG

@iqmo/browser

Version:
30 lines 3.39 MB
import{r as reactExports,j as jsxRuntimeExports}from"./index-0xtYjrTa.js";/*! * Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Anaconda nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */const main=function(T,V,t,k){t===void 0&&(t={}),k===void 0&&(k={});const E={},v=function(f){if(typeof f=="number")return f;if(f==="bokehjs")return V;if(!k[f]){const o="@bokehjs/";f.slice(0,o.length)===o&&(f=f.slice(o.length))}const d=t[f];if(d!=null)return d;const u=f.length>0&&f[f.lenght-1]==="/";return t[f+(u?"":"/")+"index"]??f},b=function(f){let d=E[f];if(!d){const u=v(f);if(d=E[u],d)E[f]=d;else{let i=function(){Object.defineProperty(d.exports,"__esModule",{value:!0})},o=function(r,e){Object.defineProperty(d.exports,r,{enumerable:!0,get:function(){return e}})};if(!T[u]){if(k[u]===!1||k[u]==!0&&parent_require)try{return d={exports:k[u]?parent_require(u):{}},E[u]=E[f]=d,d.exports}catch{}const r=new Error("Cannot find module '"+f+"'");throw r.code="MODULE_NOT_FOUND",r}d={exports:{}},E[u]=E[f]=d,T[u].call(d.exports,b,d,d.exports,i,o)}}return d.exports};b.resolve=function(f){return""};const w=b(V);return w.require=b,typeof Proxy<"u"&&(w.loader=new Proxy({},{get:function(f,d){return b(d)}})),w.register_plugin=function(f,d,u,i){u===void 0&&(u={}),i===void 0&&(i={});for(let r in f)T[r]=f[r];for(let r in u)t[r]=u[r];for(let r in i)k[r]=i[r];const o=b(d);for(let r in o)w[r]=o[r];return o},w}([function(T,V,t,k,E){k(),(0,T(1).__exportStar)(T(2),t)},function(T,V,t,k,E){k();var v=function(u,i){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(o[e]=r[e])},v(u,i)};t.__extends=function(u,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function o(){this.constructor=u}v(u,i),u.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)};function b(u){var i=typeof Symbol=="function"&&Symbol.iterator,o=i&&u[i],r=0;if(o)return o.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&r>=u.length&&(u=void 0),{value:u&&u[r++],done:!u}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(u,i){var o=typeof Symbol=="function"&&u[Symbol.iterator];if(!o)return u;var r,e,s=o.call(u),a=[];try{for(;(i===void 0||i-- >0)&&!(r=s.next()).done;)a.push(r.value)}catch(c){e={error:c}}finally{try{r&&!r.done&&(o=s.return)&&o.call(s)}finally{if(e)throw e.error}}return a}function f(u){return this instanceof f?(this.v=u,this):new f(u)}t.__assign=function(){return t.__assign=Object.assign||function(u){for(var i,o=1,r=arguments.length;o<r;o++)for(var e in i=arguments[o])Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return u},t.__assign.apply(this,arguments)},t.__rest=function(u,i){var o={};for(var r in u)Object.prototype.hasOwnProperty.call(u,r)&&i.indexOf(r)<0&&(o[r]=u[r]);if(u!=null&&typeof Object.getOwnPropertySymbols=="function"){var e=0;for(r=Object.getOwnPropertySymbols(u);e<r.length;e++)i.indexOf(r[e])<0&&Object.prototype.propertyIsEnumerable.call(u,r[e])&&(o[r[e]]=u[r[e]])}return o},t.__decorate=function(u,i,o,r){var e,s=arguments.length,a=s<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,o):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(u,i,o,r);else for(var c=u.length-1;c>=0;c--)(e=u[c])&&(a=(s<3?e(a):s>3?e(i,o,a):e(i,o))||a);return s>3&&a&&Object.defineProperty(i,o,a),a},t.__param=function(u,i){return function(o,r){i(o,r,u)}},t.__metadata=function(u,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(u,i)},t.__awaiter=function(u,i,o,r){return new(o||(o=Promise))(function(e,s){function a(Q){try{l(r.next(Q))}catch(m){s(m)}}function c(Q){try{l(r.throw(Q))}catch(m){s(m)}}function l(Q){var m;Q.done?e(Q.value):(m=Q.value,m instanceof o?m:new o(function(p){p(m)})).then(a,c)}l((r=r.apply(u,i||[])).next())})},t.__generator=function(u,i){var o,r,e,s,a={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(l){return function(Q){return function(m){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(e=2&m[0]?r.return:m[0]?r.throw||((e=r.return)&&e.call(r),0):r.next)&&!(e=e.call(r,m[1])).done)return e;switch(r=0,e&&(m=[2&m[0],e.value]),m[0]){case 0:case 1:e=m;break;case 4:return a.label++,{value:m[1],done:!1};case 5:a.label++,r=m[1],m=[0];continue;case 7:m=a.ops.pop(),a.trys.pop();continue;default:if(e=a.trys,!((e=e.length>0&&e[e.length-1])||m[0]!==6&&m[0]!==2)){a=0;continue}if(m[0]===3&&(!e||m[1]>e[0]&&m[1]<e[3])){a.label=m[1];break}if(m[0]===6&&a.label<e[1]){a.label=e[1],e=m;break}if(e&&a.label<e[2]){a.label=e[2],a.ops.push(m);break}e[2]&&a.ops.pop(),a.trys.pop();continue}m=i.call(u,a)}catch(p){m=[6,p],r=0}finally{o=e=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([l,Q])}}},t.__createBinding=Object.create?function(u,i,o,r){r===void 0&&(r=o),Object.defineProperty(u,r,{enumerable:!0,get:function(){return i[o]}})}:function(u,i,o,r){r===void 0&&(r=o),u[r]=i[o]},t.__exportStar=function(u,i){for(var o in u)o==="default"||Object.prototype.hasOwnProperty.call(i,o)||(0,t.__createBinding)(i,u,o)},t.__values=b,t.__read=w,t.__spread=function(){for(var u=[],i=0;i<arguments.length;i++)u=u.concat(w(arguments[i]));return u},t.__spreadArrays=function(){for(var u=0,i=0,o=arguments.length;i<o;i++)u+=arguments[i].length;var r=Array(u),e=0;for(i=0;i<o;i++)for(var s=arguments[i],a=0,c=s.length;a<c;a++,e++)r[e]=s[a];return r},t.__spreadArray=function(u,i,o){if(o||arguments.length===2)for(var r,e=0,s=i.length;e<s;e++)!r&&e in i||(r||(r=Array.prototype.slice.call(i,0,e)),r[e]=i[e]);return u.concat(r||Array.prototype.slice.call(i))},t.__await=f,t.__asyncGenerator=function(u,i,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,e=o.apply(u,i||[]),s=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(p){e[p]&&(r[p]=function(y){return new Promise(function(g,L){s.push([p,y,g,L])>1||c(p,y)})})}function c(p,y){try{(g=e[p](y)).value instanceof f?Promise.resolve(g.value.v).then(l,Q):m(s[0][2],g)}catch(L){m(s[0][3],L)}var g}function l(p){c("next",p)}function Q(p){c("throw",p)}function m(p,y){p(y),s.shift(),s.length&&c(s[0][0],s[0][1])}},t.__asyncDelegator=function(u){var i,o;return i={},r("next"),r("throw",function(e){throw e}),r("return"),i[Symbol.iterator]=function(){return this},i;function r(e,s){i[e]=u[e]?function(a){return(o=!o)?{value:f(u[e](a)),done:e==="return"}:s?s(a):a}:s}},t.__asyncValues=function(u){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,o=u[Symbol.asyncIterator];return o?o.call(u):(u=b(u),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(e){i[e]=u[e]&&function(s){return new Promise(function(a,c){(function(l,Q,m,p){Promise.resolve(p).then(function(y){l({value:y,done:m})},Q)})(a,c,(s=u[e](s)).done,s.value)})}}},t.__makeTemplateObject=function(u,i){return Object.defineProperty?Object.defineProperty(u,"raw",{value:i}):u.raw=i,u};var d=Object.create?function(u,i){Object.defineProperty(u,"default",{enumerable:!0,value:i})}:function(u,i){u.default=i};t.__importStar=function(u){if(u&&u.__esModule)return u;var i={};if(u!=null)for(var o in u)o!=="default"&&Object.prototype.hasOwnProperty.call(u,o)&&(0,t.__createBinding)(i,u,o);return d(i,u),i},t.__importDefault=function(u){return u&&u.__esModule?u:{default:u}},t.__classPrivateFieldGet=function(u,i,o,r){if(o==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?u!==i||!r:!i.has(u))throw new TypeError("Cannot read private member from an object whose class did not declare it");return o==="m"?r:o==="a"?r.call(u):r?r.value:i.get(u)},t.__classPrivateFieldSet=function(u,i,o,r,e){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!e)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?u!==i||!e:!i.has(u))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?e.call(u,o):e?e.value=o:i.set(u,o),o}},function(T,V,t,k,E){k();const v=T(1);E("version",T(3).version),E("index",T(4).index),t.embed=(0,v.__importStar)(T(4)),t.protocol=(0,v.__importStar)(T(406)),t._testing=(0,v.__importStar)(T(407));var b=T(19);E("logger",b.logger),E("set_log_level",b.set_log_level),E("settings",T(28).settings),E("Models",T(7).Models),E("documents",T(5).documents),E("safely",T(408).safely)},function(T,V,t,k,E){k(),t.version="2.4.3"},function(T,V,t,k,E){k();const v=T(5),b=T(19),w=T(34),f=T(13),d=T(8),u=T(16),i=T(397),o=T(399),r=T(398);var e=T(397);E("add_document_standalone",e.add_document_standalone),E("index",e.index),E("add_document_from_session",T(399).add_document_from_session);var s=T(404);async function a(c,l,Q,m){(0,d.isString)(c)&&(c=JSON.parse((0,w.unescape)(c)));const p={};for(const[g,L]of(0,f.entries)(c))p[g]=v.Document.from_json(L);const y=[];for(const g of l){const L=(0,r._resolve_element)(g),A=(0,r._resolve_root_elements)(g);if(g.docid!=null)y.push(await(0,i.add_document_standalone)(p[g.docid],L,A,g.use_for_title));else{if(g.token==null)throw new Error("Error rendering Bokeh items: either 'docid' or 'token' was expected.");{const x=(0,o._get_ws_url)(Q,m);b.logger.debug(`embed: computed ws url: ${x}`);try{y.push(await(0,o.add_document_from_session)(x,g.token,L,A,g.use_for_title)),console.log("Bokeh items were rendered successfully")}catch(H){console.log("Error rendering Bokeh items:",H)}}}}return y}E("embed_items_notebook",s.embed_items_notebook),E("kernels",s.kernels),E("BOKEH_ROOT",T(398).BOKEH_ROOT),t.embed_item=async function(c,l){const Q={},m=(0,w.uuid4)();Q[m]=c.doc,l==null&&(l=c.target_id),document.getElementById(l)?.classList.add(r.BOKEH_ROOT);const y={roots:{[c.root_id]:l},root_ids:[c.root_id],docid:m};await(0,u.defer)();const[g]=await a(Q,[y]);return g},t.embed_items=async function(c,l,Q,m){return await(0,u.defer)(),a(c,l,Q,m)}},function(T,V,t,k,E){k();const v=T(1);(0,v.__exportStar)(T(6),t),(0,v.__exportStar)(T(35),t)},function(T,V,t,k,E){k();const v=T(1),b=T(7),w=T(3),f=T(19),d=T(251),u=T(14),i=T(30),o=T(15),r=T(17),e=T(31),s=T(29),a=T(9),c=T(13),l=(0,v.__importStar)(T(77)),Q=T(26),m=T(8),p=T(309),y=T(75),g=T(53),L=T(396),A=T(35);class x{constructor(M){this.document=M,this.session=null,this.subscribed_models=new Set}send_event(M){const C=new A.MessageSentEvent(this.document,"bokeh_event",M.to_json());this.document._trigger_on_change(C)}trigger(M){for(const C of this.subscribed_models)M.origin!=null&&M.origin!=C||C._process_event(M)}}t.EventManager=x,x.__name__="EventManager",t.documents=[],t.DEFAULT_TITLE="Bokeh Application";class H{constructor(M){var C;t.documents.push(this),this._init_timestamp=Date.now(),this._resolver=(C=M?.resolver)!==null&&C!==void 0?C:new b.ModelResolver,this._title=t.DEFAULT_TITLE,this._roots=[],this._all_models=new Map,this._all_models_freeze_count=0,this._callbacks=new Map,this._message_callbacks=new Map,this.event_manager=new x(this),this.idle=new o.Signal0(this,"idle"),this._idle_roots=new WeakMap,this._interactive_timestamp=null,this._interactive_plot=null}get layoutables(){return this._roots.filter(M=>M instanceof p.LayoutDOM)}get is_idle(){for(const M of this.layoutables)if(!this._idle_roots.has(M))return!1;return!0}notify_idle(M){this._idle_roots.set(M,!0),this.is_idle&&(f.logger.info(`document idle at ${Date.now()-this._init_timestamp} ms`),this.event_manager.send_event(new d.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(M,C=null){this._interactive_plot==null&&(this._interactive_plot=M,this._interactive_plot.trigger_event(new d.LODStart)),this._interactive_finalize=C,this._interactive_timestamp=Date.now()}interactive_stop(){this._interactive_plot!=null&&(this._interactive_plot.trigger_event(new d.LODEnd),this._interactive_finalize!=null&&this._interactive_finalize()),this._interactive_plot=null,this._interactive_timestamp=null,this._interactive_finalize=null}interactive_duration(){return this._interactive_timestamp==null?-1:Date.now()-this._interactive_timestamp}destructively_move(M){if(M===this)throw new Error("Attempted to overwrite a document with itself");M.clear();const C=(0,a.copy)(this._roots);this.clear();for(const R of C)if(R.document!=null)throw new Error(`Somehow we didn't detach ${R}`);if(this._all_models.size!=0)throw new Error(`this._all_models still had stuff in it: ${this._all_models}`);for(const R of C)M.add_root(R);M.set_title(this._title)}_push_all_models_freeze(){this._all_models_freeze_count+=1}_pop_all_models_freeze(){this._all_models_freeze_count-=1,this._all_models_freeze_count===0&&this._recompute_all_models()}_invalidate_all_models(){f.logger.debug("invalidating document models"),this._all_models_freeze_count===0&&this._recompute_all_models()}_recompute_all_models(){let M=new Set;for(const z of this._roots)M=l.union(M,z.references());const C=new Set(this._all_models.values()),R=l.difference(C,M),D=l.difference(M,C),B=new Map;for(const z of M)B.set(z.id,z);for(const z of R)z.detach_document();for(const z of D)z.attach_document(this);this._all_models=B}roots(){return this._roots}add_root(M,C){if(f.logger.debug(`Adding root: ${M}`),!(0,a.includes)(this._roots,M)){this._push_all_models_freeze();try{this._roots.push(M)}finally{this._pop_all_models_freeze()}this._trigger_on_change(new A.RootAddedEvent(this,M,C))}}remove_root(M,C){const R=this._roots.indexOf(M);if(!(R<0)){this._push_all_models_freeze();try{this._roots.splice(R,1)}finally{this._pop_all_models_freeze()}this._trigger_on_change(new A.RootRemovedEvent(this,M,C))}}title(){return this._title}set_title(M,C){M!==this._title&&(this._title=M,this._trigger_on_change(new A.TitleChangedEvent(this,M,C)))}get_model_by_id(M){var C;return(C=this._all_models.get(M))!==null&&C!==void 0?C:null}get_model_by_name(M){const C=[];for(const R of this._all_models.values())R instanceof g.Model&&R.name==M&&C.push(R);switch(C.length){case 0:return null;case 1:return C[0];default:throw new Error(`Multiple models are named '${M}'`)}}on_message(M,C){const R=this._message_callbacks.get(M);R==null?this._message_callbacks.set(M,new Set([C])):R.add(C)}remove_on_message(M,C){var R;(R=this._message_callbacks.get(M))===null||R===void 0||R.delete(C)}_trigger_on_message(M,C){const R=this._message_callbacks.get(M);if(R!=null)for(const D of R)D(C)}on_change(M,C=!1){this._callbacks.has(M)||this._callbacks.set(M,C)}remove_on_change(M){this._callbacks.delete(M)}_trigger_on_change(M){for(const[C,R]of this._callbacks)if(!R&&M instanceof A.DocumentEventBatch)for(const D of M.events)C(D);else C(M)}_notify_change(M,C,R,D,B){this._trigger_on_change(new A.ModelChangedEvent(this,M,C,R,D,B?.setter_id,B?.hint))}static _instantiate_object(M,C,R,D){const B=Object.assign(Object.assign({},R),{id:M,__deferred__:!0});return new(D.get(C))(B)}static _instantiate_references_json(M,C,R){var D;const B=new Map;for(const z of M){const N=z.id,I=z.type,O=(D=z.attributes)!==null&&D!==void 0?D:{};let G=C.get(N);G==null&&(G=H._instantiate_object(N,I,O,R),z.subtype!=null&&G.set_subtype(z.subtype)),B.set(G.id,G)}return B}static _resolve_refs(M,C,R,D){function B(z){var N;if((0,r.is_ref)(z)){const I=(N=C.get(z.id))!==null&&N!==void 0?N:R.get(z.id);if(I!=null)return I;throw new Error(`reference ${JSON.stringify(z)} isn't known (not in Document?)`)}if((0,e.is_NDArray_ref)(z)){const{buffer:I,dtype:O,shape:G}=(0,e.decode_NDArray)(z,D);return(0,s.ndarray)(I,{dtype:O,shape:G})}return(0,m.isArray)(z)?function(I){const O=[];for(const G of I)O.push(B(G));return O}(z):(0,m.isPlainObject)(z)?function(I){const O={};for(const[G,q]of(0,c.entries)(I))O[G]=B(q);return O}(z):z}return B(M)}static _initialize_references_json(M,C,R,D){const B=new Map;for(const{id:O,attributes:G}of M){const q=!C.has(O),Z=q?R.get(O):C.get(O),U=H._resolve_refs(G,C,R,D);Z.setv(U,{silent:!0}),B.set(O,{instance:Z,is_new:q})}const z=[],N=new Set;function I(O){if(O instanceof u.HasProps){if(B.has(O.id)&&!N.has(O.id)){N.add(O.id);const{instance:G,is_new:q}=B.get(O.id),{attributes:Z}=G;for(const U of(0,c.values)(Z))I(U);q&&(G.finalize(),z.push(G))}}else if((0,m.isArray)(O))for(const G of O)I(G);else if((0,m.isPlainObject)(O))for(const G of(0,c.values)(O))I(G)}for(const O of B.values())I(O.instance);for(const O of z)O.connect_signals()}static _event_for_attribute_change(M,C,R,D,B){if(D.get_model_by_id(M.id).property(C).syncable){const z={kind:"ModelChanged",model:{id:M.id},attr:C,new:R};return u.HasProps._json_record_references(D,R,B,{recursive:!0}),z}return null}static _events_to_sync_objects(M,C,R,D){const B=Object.keys(M.attributes),z=Object.keys(C.attributes),N=(0,a.difference)(B,z),I=(0,a.difference)(z,B),O=(0,a.intersection)(B,z),G=[];for(const q of N)f.logger.warn(`Server sent key ${q} but we don't seem to have it in our JSON`);for(const q of I){const Z=C.attributes[q];G.push(H._event_for_attribute_change(M,q,Z,R,D))}for(const q of O){const Z=M.attributes[q],U=C.attributes[q];Z==null&&U==null||(Z==null||U==null?G.push(H._event_for_attribute_change(M,q,U,R,D)):q=="data"||(0,Q.is_equal)(Z,U)||G.push(H._event_for_attribute_change(M,q,U,R,D)))}return G.filter(q=>q!=null)}static _compute_patch_since_json(M,C){const R=C.to_json(!1);function D(ot){const ft=new Map;for(const Ct of ot.roots.references)ft.set(Ct.id,Ct);return ft}const B=D(M),z=new Map,N=[];for(const ot of M.roots.root_ids)z.set(ot,B.get(ot)),N.push(ot);const I=D(R),O=new Map,G=[];for(const ot of R.roots.root_ids)O.set(ot,I.get(ot)),G.push(ot);if(N.sort(),G.sort(),(0,a.difference)(N,G).length>0||(0,a.difference)(G,N).length>0)throw new Error("Not implemented: computing add/remove of document roots");const q=new Set;let Z=[];for(const ot of C._all_models.keys())if(B.has(ot)){const ft=H._events_to_sync_objects(B.get(ot),I.get(ot),C,q);Z=Z.concat(ft)}const U=new i.Serializer({include_defaults:!1});return U.to_serializable([...q]),{references:[...U.definitions],events:Z}}to_json_string(M=!0){return JSON.stringify(this.to_json(M))}to_json(M=!0){const C=new i.Serializer({include_defaults:M}),R=C.to_serializable(this._roots);return{version:w.version,title:this._title,roots:{root_ids:R.map(D=>D.id),references:[...C.definitions]}}}static from_json_string(M){const C=JSON.parse(M);return H.from_json(C)}static from_json(M){f.logger.debug("Creating Document from JSON");const C=M.version,R=C.indexOf("+")!==-1||C.indexOf("-")!==-1,D=`Library versions: JS (${w.version}) / Python (${C})`;R||w.version.replace(/-(dev|rc)\./,"$1")==C?f.logger.debug(D):(f.logger.warn("JS/Python version mismatch"),f.logger.warn(D));const B=new b.ModelResolver;M.defs!=null&&(0,L.resolve_defs)(M.defs,B);const z=M.roots,N=z.root_ids,I=z.references,O=H._instantiate_references_json(I,new Map,B);H._initialize_references_json(I,new Map,O,new Map);const G=new H({resolver:B});G._push_all_models_freeze();for(const q of N){const Z=O.get(q);Z!=null&&G.add_root(Z)}return G._pop_all_models_freeze(),G.set_title(M.title),G}replace_with_json(M){H.from_json(M).destructively_move(this)}create_json_patch_string(M){return JSON.stringify(this.create_json_patch(M))}create_json_patch(M){for(const D of M)if(D.document!=this)throw new Error("Cannot create a patch using events from a different document");const C=new i.Serializer,R=C.to_serializable(M);for(const D of this._all_models.values())C.remove_def(D);return{events:R,references:[...C.definitions]}}apply_json_patch(M,C=new Map,R){const D=M.references,B=M.events,z=H._instantiate_references_json(D,this._all_models,this._resolver);C instanceof Map||(C=new Map(C));for(const O of B)switch(O.kind){case"RootAdded":case"RootRemoved":case"ModelChanged":{const G=O.model.id,q=this._all_models.get(G);if(q!=null)z.set(G,q);else if(!z.has(G))throw f.logger.warn(`Got an event for unknown model ${O.model}"`),new Error("event model wasn't known");break}}const N=new Map(this._all_models),I=new Map;for(const[O,G]of z)N.has(O)||I.set(O,G);H._initialize_references_json(D,N,I,C);for(const O of B)switch(O.kind){case"MessageSent":{const{msg_type:G,msg_data:q}=O;let Z;if(q===void 0){if(C.size!=1)throw new Error("expected exactly one buffer");{const[[,U]]=C;Z=U}}else Z=H._resolve_refs(q,N,I,C);this._trigger_on_message(G,Z);break}case"ModelChanged":{const G=O.model.id,q=this._all_models.get(G);if(q==null)throw new Error(`Cannot apply patch to ${G} which is not in the document`);const Z=O.attr,U=H._resolve_refs(O.new,N,I,C);q.setv({[Z]:U},{setter_id:R});break}case"ColumnDataChanged":{const G=O.column_source.id,q=this._all_models.get(G);if(q==null)throw new Error(`Cannot stream to ${G} which is not in the document`);const Z=H._resolve_refs(O.new,new Map,new Map,C);if(O.cols!=null)for(const U in q.data)U in Z||(Z[U]=q.data[U]);q.setv({data:Z},{setter_id:R,check_eq:!1});break}case"ColumnsStreamed":{const G=O.column_source.id,q=this._all_models.get(G);if(q==null)throw new Error(`Cannot stream to ${G} which is not in the document`);if(!(q instanceof y.ColumnDataSource))throw new Error("Cannot stream to non-ColumnDataSource");const Z=O.data,U=O.rollover;q.stream(Z,U,R);break}case"ColumnsPatched":{const G=O.column_source.id,q=this._all_models.get(G);if(q==null)throw new Error(`Cannot patch ${G} which is not in the document`);if(!(q instanceof y.ColumnDataSource))throw new Error("Cannot patch non-ColumnDataSource");const Z=O.patches;q.patch(Z,R);break}case"RootAdded":{const G=O.model.id,q=z.get(G);this.add_root(q,R);break}case"RootRemoved":{const G=O.model.id,q=z.get(G);this.remove_root(q,R);break}case"TitleChanged":this.set_title(O.title,R);break;default:throw new Error(`Unknown patch event ${JSON.stringify(O)}`)}}}t.Document=H,H.__name__="Document"},function(T,V,t,k,E){k();const v=T(1),b=T(8),w=T(13),f=T(14);t.overrides={};const d=new Map;t.Models=r=>{const e=t.Models.get(r);if(e!=null)return e;throw new Error(`Model '${r}' does not exist. This could be due to a widget or a custom model not being registered before first usage.`)},t.Models.get=r=>{var e;return(e=t.overrides[r])!==null&&e!==void 0?e:d.get(r)},t.Models.register=(r,e)=>{t.overrides[r]=e},t.Models.unregister=r=>{delete t.overrides[r]},t.Models.register_models=(r,e=!1,s)=>{var a;if(r!=null){for(const c of(0,b.isArray)(r)?r:(0,w.values)(r))if(a=c,(0,b.isObject)(a)&&a.prototype instanceof f.HasProps){const l=c.__qualified__;e||!d.has(l)?d.set(l,c):s!=null?s(l):console.warn(`Model '${l}' was already registered`)}}},t.register_models=t.Models.register_models,t.Models.registered_names=()=>[...d.keys()];class u{constructor(){this._known_models=new Map}get(e,s){var a;const c=(a=t.Models.get(e))!==null&&a!==void 0?a:this._known_models.get(e);if(c!=null)return c;if(s!==void 0)return s;throw new Error(`Model '${e}' does not exist. This could be due to a widget or a custom model not being registered before first usage.`)}register(e){const s=e.__qualified__;this.get(s,null)==null?this._known_models.set(s,e):console.warn(`Model '${s}' was already registered with this resolver`)}}t.ModelResolver=u,u.__name__="ModelResolver";const i=(0,v.__importStar)(T(38));(0,t.register_models)(i);const o=(0,v.__importStar)(T(392));(0,t.register_models)(o)},function(T,V,t,k,E){k();const v=T(9),b=Object.prototype.toString;function w(r){return r===!0||r===!1||b.call(r)==="[object Boolean]"}function f(r){return b.call(r)==="[object Number]"}function d(r){return b.call(r)==="[object String]"}function u(r){return typeof r=="symbol"}function i(r){const e=typeof r;return e==="function"||e==="object"&&!!r}function o(r){return i(r)&&r[Symbol.iterator]!==void 0}t.isBoolean=w,t.isNumber=f,t.isInteger=function(r){return f(r)&&Number.isInteger(r)},t.isString=d,t.isSymbol=u,t.isPrimitive=function(r){return r===null||w(r)||f(r)||d(r)||u(r)},t.isFunction=function(r){return b.call(r)==="[object Function]"},t.isArray=function(r){return Array.isArray(r)},t.isArrayOf=function(r,e){return(0,v.every)(r,e)},t.isArrayableOf=function(r,e){for(let s=0,a=r.length;s<a;s++)if(!e(r[s]))return!1;return!0},t.isTypedArray=function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},t.isObject=i,t.isPlainObject=function(r){return i(r)&&(r.constructor==null||r.constructor===Object)},t.isIterable=o,t.isArrayable=function(r){return o(r)&&"length"in r}},function(T,V,t,k,E){k();const v=T(10),b=T(11),w=T(12);E("map",w.map),E("reduce",w.reduce),E("min",w.min),E("min_by",w.min_by),E("max",w.max),E("max_by",w.max_by),E("sum",w.sum),E("cumsum",w.cumsum),E("every",w.every),E("some",w.some),E("find",w.find),E("find_last",w.find_last),E("find_index",w.find_index),E("find_last_index",w.find_last_index),E("sorted_index",w.sorted_index),E("is_empty",w.is_empty);const f=Array.prototype.slice;function d(r){return f.call(r)}function u(r){return[].concat(...r)}function i(r,e){return r.indexOf(e)!==-1}function o(r,e,s=1){(0,b.assert)(s>0,"'step' must be a positive number"),e==null&&(e=r,r=0);const{max:a,ceil:c,abs:l}=Math,Q=r<=e?s:-s,m=a(c(l(e-r)/s),0),p=new Array(m);for(let y=0;y<m;y++,r+=Q)p[y]=r;return p}t.head=function(r){return r[0]},t.tail=function(r){return r[r.length-1]},t.last=function(r){return r[r.length-1]},t.copy=d,t.concat=u,t.includes=i,t.contains=i,t.nth=function(r,e){return r[e>=0?e:r.length+e]},t.zip=function(...r){if(r.length==0)return[];const e=(0,w.min)(r.map(c=>c.length)),s=r.length,a=new Array(e);for(let c=0;c<e;c++){a[c]=new Array(s);for(let l=0;l<s;l++)a[c][l]=r[l][c]}return a},t.unzip=function(r){const e=r.length,s=(0,w.min)(r.map(c=>c.length)),a=Array(s);for(let c=0;c<s;c++)a[c]=new Array(e);for(let c=0;c<e;c++)for(let l=0;l<s;l++)a[l][c]=r[c][l];return a},t.range=o,t.linspace=function(r,e,s=100){const a=(e-r)/(s-1),c=new Array(s);for(let l=0;l<s;l++)c[l]=r+a*l;return c},t.transpose=function(r){const e=r.length,s=r[0].length,a=[];for(let c=0;c<s;c++){a[c]=[];for(let l=0;l<e;l++)a[c][l]=r[l][c]}return a},t.argmin=function(r){return(0,w.min_by)(o(r.length),e=>r[e])},t.argmax=function(r){return(0,w.max_by)(o(r.length),e=>r[e])},t.sort_by=function(r,e){const s=r.map((a,c)=>({value:a,index:c,key:e(a)}));return s.sort((a,c)=>{const l=a.key,Q=c.key;if(l!==Q){if(l>Q||l===void 0)return 1;if(l<Q||Q===void 0)return-1}return a.index-c.index}),s.map(a=>a.value)},t.uniq=function(r){const e=new Set;for(const s of r)e.add(s);return[...e]},t.uniq_by=function(r,e){const s=[],a=[];for(const c of r){const l=e(c);i(a,l)||(a.push(l),s.push(c))}return s},t.union=function(...r){const e=new Set;for(const s of r)for(const a of s)e.add(a);return[...e]},t.intersection=function(r,...e){const s=[];t:for(const a of r)if(!i(s,a)){for(const c of e)if(!i(c,a))continue t;s.push(a)}return s},t.difference=function(r,...e){const s=u(e);return r.filter(a=>!i(s,a))},t.remove_at=function(r,e){const s=d(r);return s.splice(e,1),s},t.remove_by=function(r,e){for(let s=0;s<r.length;)e(r[s])?r.splice(s,1):s++},t.shuffle=function(r){const e=r.length,s=new Array(e);for(let a=0;a<e;a++){const c=(0,v.randomIn)(0,a);c!==a&&(s[a]=s[c]),s[c]=r[a]}return s},t.pairwise=function(r,e){const s=r.length,a=new Array(s-1);for(let c=0;c<s-1;c++)a[c]=e(r[c],r[c+1]);return a},t.reversed=function(r){const e=r.length,s=new Array(e);for(let a=0;a<e;a++)s[e-a-1]=r[a];return s},t.repeat=function(r,e){const s=new Array(e);for(let a=0;a<e;a++)s[a]=r;return s}},function(T,V,t,k,E){k();const{PI:v}=Math;function b(u){if(u==0)return 0;for(;u<=0;)u+=2*v;for(;u>2*v;)u-=2*v;return u}function w(u,i){return b(u-i)}function f(){return Math.random()}function d(u){switch(u){case"deg":return v/180;case"rad":return 1;case"grad":return v/200;case"turn":return 2*v}}t.angle_norm=b,t.angle_dist=w,t.angle_between=function(u,i,o,r=!1){const e=w(i,o);if(e==0)return!1;if(e==2*v)return!0;const s=b(u),a=w(i,s)<=e&&w(s,o)<=e;return r?!a:a},t.random=f,t.randomIn=function(u,i){return i==null&&(i=u,u=0),u+Math.floor(Math.random()*(i-u+1))},t.atan2=function(u,i){return Math.atan2(i[1]-u[1],i[0]-u[0])},t.radians=function(u){return u*(v/180)},t.degrees=function(u){return u/(v/180)},t.resolve_angle=function(u,i){return-d(i)*u},t.to_radians_coeff=d,t.rnorm=function(u,i){let o,r;for(;o=f(),r=f(),r=(2*r-1)*Math.sqrt(1/Math.E*2),!(-4*o*o*Math.log(o)>=r*r););let e=r/o;return e=u+i*e,e},t.clamp=function(u,i,o){return u<i?i:u>o?o:u},t.log=function(u,i=Math.E){return Math.log(u)/Math.log(i)},t.float32_epsilon=11920928955078125e-23},function(T,V,t,k,E){k();class v extends Error{}t.AssertionError=v,v.__name__="AssertionError",t.assert=function(b,w){if(!(b===!0||b!==!1&&b()))throw new v(w??"Assertion failed")},t.unreachable=function(){throw new Error("unreachable code")}},function(T,V,t,k,E){k();const v=T(10);function b(e,s,a,...c){const l=e.length;s<0&&(s+=l),s<0?s=0:s>l&&(s=l),a==null||a>l-s?a=l-s:a<0&&(a=0);const Q=l-a+c.length,m=new e.constructor(Q);let p=0;for(;p<s;p++)m[p]=e[p];for(const y of c)m[p++]=y;for(let y=s+a;y<l;y++)m[p++]=e[y];return m}function w(e,s){return b(e,s,e.length-s)}function f(e,s){const a=e.length,c=new e.constructor(a);for(let l=0;l<a;l++)c[l]=s(e[l],l,e);return c}function d(e,s,a){const c=e.length;if(a===void 0&&c==0)throw new Error("can't reduce an empty array without an initial value");let l,Q;for(a===void 0?(l=e[0],Q=1):(l=a,Q=0);Q<c;Q++)l=s(l,e[Q],Q,e);return l}function u(e){return function(s,a){const c=s.length;let l=e>0?0:c-1;for(;l>=0&&l<c;l+=e)if(a(s[l]))return l;return-1}}function i(e,s){let a=0,c=e.length;for(;a<c;){const l=Math.floor((a+c)/2);e[l]<s?a=l+1:c=l}return a}function o(e,s,a,c,l){const Q=(l-a)/(c-s);let m=Q*(e-s)+a;return isFinite(m)||(m=Q*(e-c)+l,isFinite(m)||a!=l||(m=a)),m}function r(e,s){if(e<s[0])return-1;if(e>s[s.length-1])return s.length;let a=0,c=s.length-1;for(;c-a!=1;){const l=a+Math.floor((c-a)/2);e>=s[l]?a=l:c=l}return a}t.is_empty=function(e){return e.length==0},t.copy=function(e){return Array.isArray(e)?e.slice():new e.constructor(e)},t.splice=b,t.head=w,t.insert=function(e,s,a){return b(e,a,0,s)},t.append=function(e,s){return b(e,e.length,0,s)},t.prepend=function(e,s){return b(e,0,0,s)},t.indexOf=function(e,s){for(let a=0,c=e.length;a<c;a++)if(e[a]===s)return a;return-1},t.subselect=function(e,s){const a=s.length,c=new e.constructor(a);for(let l=0;l<a;l++)c[l]=e[s[l]];return c},t.mul=function(e,s,a){const c=e.length,l=a??new e.constructor(c);for(let Q=0;Q<c;Q++)l[Q]=e[Q]*s;return l},t.map=f,t.inplace_map=function(e,s,a){const c=e.length,l=a??e;for(let Q=0;Q<c;Q++)l[Q]=s(e[Q],Q)},t.filter=function(e,s){const a=e.length,c=new e.constructor(a);let l=0;for(let Q=0;Q<a;Q++){const m=e[Q];s(m,Q,e)&&(c[l++]=m)}return w(c,l)},t.reduce=d,t.min=function(e){let s,a=1/0;for(let c=0,l=e.length;c<l;c++)s=e[c],!isNaN(s)&&s<a&&(a=s);return a},t.max=function(e){let s,a=-1/0;for(let c=0,l=e.length;c<l;c++)s=e[c],!isNaN(s)&&s>a&&(a=s);return a},t.minmax=function(e){let s,a=1/0,c=-1/0;for(let l=0,Q=e.length;l<Q;l++)s=e[l],isNaN(s)||(s<a&&(a=s),s>c&&(c=s));return[a,c]},t.minmax2=function(e,s){let a,c,l=1/0,Q=-1/0,m=1/0,p=-1/0;const y=Math.min(e.length,s.length);for(let g=0;g<y;g++)a=e[g],c=s[g],isNaN(a)||isNaN(c)||(a<l&&(l=a),a>Q&&(Q=a),c<m&&(m=c),c>p&&(p=c));return[l,Q,m,p]},t.min_by=function(e,s){if(e.length==0)throw new Error("min_by() called with an empty array");let a=e[0],c=s(a);for(let l=1,Q=e.length;l<Q;l++){const m=e[l],p=s(m);p<c&&(a=m,c=p)}return a},t.max_by=function(e,s){if(e.length==0)throw new Error("max_by() called with an empty array");let a=e[0],c=s(a);for(let l=1,Q=e.length;l<Q;l++){const m=e[l],p=s(m);p>c&&(a=m,c=p)}return a},t.sum=function(e){let s=0;for(let a=0,c=e.length;a<c;a++)s+=e[a];return s},t.cumsum=function(e){const s=new e.constructor(e.length);return d(e,(a,c,l)=>s[l]=a+c,0),s},t.every=function(e,s){for(let a=0,c=e.length;a<c;a++)if(!s(e[a]))return!1;return!0},t.some=function(e,s){for(let a=0,c=e.length;a<c;a++)if(s(e[a]))return!0;return!1},t.index_of=function(e,s){for(let a=0,c=e.length;a<c;a++)if(e[a]===s)return a;return-1},t.find_index=u(1),t.find_last_index=u(-1),t.find=function(e,s){const a=(0,t.find_index)(e,s);return a==-1?void 0:e[a]},t.find_last=function(e,s){const a=(0,t.find_last_index)(e,s);return a==-1?void 0:e[a]},t.sorted_index=i,t.bin_counts=function(e,s){const a=s.length-1,c=Array(a).fill(0);for(let l=0;l<e.length;l++){const Q=i(s,e[l]);c[(0,v.clamp)(Q-1,0,a-1)]+=1}return c},t.interpolate=function(e,s,a){const c=e.length,l=new Array(c);for(let Q=0;Q<c;Q++){const m=e[Q];if(isNaN(m)){l[Q]=m;continue}const p=r(m,s);if(p==-1)l[Q]=a[0];else if(p==s.length)l[Q]=a[a.length-1];else if(p==s.length-1||s[p]==m)l[Q]=a[p];else{const y=s[p],g=a[p],L=s[p+1],A=a[p+1];l[Q]=o(m,y,g,L,A)}}return l},t.left_edge_index=r,t.norm=function(e,s,a){const c=a-s;return f(e,l=>(l-s)/c)}},function(T,V,t,k,E){k();const v=T(9),{hasOwnProperty:b}=Object.prototype;function w(d){return Object.keys(d).length}function f(d){return w(d)==0}t.keys=Object.keys,t.values=Object.values,t.entries=Object.entries,t.extend=Object.assign,t.clone=function(d){return Object.assign({},d)},t.merge=function(d,u){const i=Object.create(Object.prototype),o=(0,v.concat)([Object.keys(d),Object.keys(u)]);for(const r of o){const e=b.call(d,r)?d[r]:[],s=b.call(u,r)?u[r]:[];i[r]=(0,v.union)(e,s)}return i},t.size=w,t.is_empty=f,t.isEmpty=f,t.to_object=function(d){const u={};for(const[i,o]of d)u[i]=o;return u}},function(T,V,t,k,E){k();const v=T(1);var b;const w=T(15),f=T(17),d=(0,v.__importStar)(T(18)),u=(0,v.__importStar)(T(21)),i=T(34),o=T(13),r=T(8),e=T(26),s=T(30),a=T(35),c=T(26),l=T(36),Q=T(37),m=(0,v.__importStar)(T(21));class p extends(0,w.Signalable)(){constructor(g={}){var L,A;super(),this._subtype=void 0,this.document=null,this.destroyed=new w.Signal0(this,"destroyed"),this.change=new w.Signal0(this,"change"),this.transformchange=new w.Signal0(this,"transformchange"),this.exprchange=new w.Signal0(this,"exprchange"),this.properties={},this._watchers=new WeakMap,this._pending=!1,this._changing=!1;const x=g instanceof Map?g.get.bind(g):H=>g[H];this.id=(L=x("id"))!==null&&L!==void 0?L:(0,i.uniqueId)();for(const[H,{type:S,default_value:M,options:C}]of(0,o.entries)(this._props)){let R;S instanceof d.PropertyAlias?Object.defineProperty(this.properties,H,{get:()=>this.properties[S.attr],configurable:!1,enumerable:!1}):(R=S instanceof u.Kind?new d.PrimitiveProperty(this,H,S,M,x(H),C):new S(this,H,u.Any,M,x(H),C),this.properties[H]=R)}(A=x("__deferred__"))!==null&&A!==void 0&&A||(this.finalize(),this.connect_signals())}get is_syncable(){return!0}set type(g){console.warn("prototype.type = 'ModelName' is deprecated, use static __name__ instead"),this.constructor.__name__=g}get type(){return this.constructor.__qualified__}static get __qualified__(){const{__module__:g,__name__:L}=this;return g!=null?`${g}.${L}`:L}static get[Symbol.toStringTag](){return this.__name__}static _fix_default(g,L){if(g===void 0||(0,r.isFunction)(g))return g;if((0,r.isPrimitive)(g))return()=>g;{const A=new Q.Cloner;return()=>A.clone(g)}}static define(g){for(const[L,A]of(0,o.entries)((0,r.isFunction)(g)?g(m):g)){if(this.prototype._props[L]!=null)throw new Error(`attempted to redefine property '${this.prototype.type}.${L}'`);if(this.prototype[L]!=null)throw new Error(`attempted to redefine attribute '${this.prototype.type}.${L}'`);Object.defineProperty(this.prototype,L,{get(){return this.properties[L].get_value()},set(R){return this.setv({[L]:R}),this},configurable:!1,enumerable:!0});const[x,H,S={}]=A,M={type:x,default_value:this._fix_default(H,L),options:S},C=Object.assign({},this.prototype._props);C[L]=M,this.prototype._props=C}}static internal(g){const L={};for(const[A,x]of(0,o.entries)((0,r.isFunction)(g)?g(m):g)){const[H,S,M={}]=x;L[A]=[H,S,Object.assign(Object.assign({},M),{internal:!0})]}this.define(L)}static mixins(g){function L(H,S){const M={};for(const[C,R]of(0,o.entries)(S))M[H+C]=R;return M}const A={},x=[];for(const H of(0,r.isArray)(g)?g:[g])if((0,r.isArray)(H)){const[S,M]=H;(0,o.extend)(A,L(S,M)),x.push([S,M])}else{const S=H;(0,o.extend)(A,S),x.push(["",S])}this.define(A),this.prototype._mixins=[...this.prototype._mixins,...x]}static override(g){for(const[L,A]of(0,o.entries)(g)){const x=this._fix_default(A,L),H=this.prototype._props[L];if(H==null)throw new Error(`attempted to override nonexistent '${this.prototype.type}.${L}'`);const S=Object.assign({},this.prototype._props);S[L]=Object.assign(Object.assign({},H),{default_value:x}),this.prototype._props=S}}toString(){return`${this.type}(${this.id})`}property(g){const L=this.properties[g];if(L!=null)return L;throw new Error(`unknown property ${this.type}.${g}`)}get attributes(){const g={};for(const L of this)g[L.attr]=L.get_value();return g}[Q.clone](g){const L=new Map;for(const A of this)A.dirty&&L.set(A.attr,g.clone(A.get_value()));return new this.constructor(L)}[c.equals](g,L){for(const A of this){const x=g.property(A.attr);if(!L.eq(A.get_value(),x.get_value()))return!1}return!0}[l.pretty](g){const L=g.token,A=[];for(const x of this)if(x.dirty){const H=x.get_value();A.push(`${x.attr}${L(":")} ${g.to_string(H)}`)}return`${this.constructor.__qualified__}${L("(")}${L("{")}${A.join(`${L(",")} `)}${L("}")}${L(")")}`}[s.serialize](g){const L=this.ref();g.add_ref(this,L);const A=this.struct();for(const x of this)x.syncable&&(g.include_defaults||x.dirty)&&(A.attributes[x.attr]=g.to_serializable(x.get_value()));return g.add_def(this,A),L}finalize(){for(const g of this){if(!(g instanceof d.VectorSpec||g instanceof d.ScalarSpec))continue;const L=g.get_value();if(L!=null){const{transform:A,expr:x}=L;A!=null&&this.connect(A.change,()=>this.transformchange.emit()),x!=null&&this.connect(x.change,()=>this.exprchange.emit())}}this.initialize()}initialize(){}connect_signals(){}disconnect_signals(){w.Signal.disconnectReceiver(this)}destroy(){this.disconnect_signals(),this.destroyed.emit()}clone(){return new Q.Cloner().clone(this)}changed_for(g){const L=this._watchers.get(g);return this._watchers.set(g,!1),L==null||L}_setv(g,L){const A=L.check_eq,x=[],H=this._changing;this._changing=!0;for(const[S,M]of g)A!==!1&&(0,e.is_equal)(S.get_value(),M)||(S.set_value(M),x.push(S));x.length>0&&(this._watchers=new WeakMap,this._pending=!0);for(const S of x)S.change.emit();if(!H){if(!L.no_change)for(;this._pending;)this._pending=!1,this.change.emit();this._pending=!1,this._changing=!1}}setv(g,L={}){const A=(0,o.entries)(g);if(A.length==0)return;if(L.silent===!0){this._watchers=new WeakMap;for(const[M,C]of A)this.properties[M].set_value(C);return}const x=new Map,H=new Map;for(const[M,C]of A){const R=this.properties[M];x.set(R,C),H.set(R,R.get_value())}this._setv(x,L);const{document:S}=this;if(S!=null){const M=[];for(const[C,R]of H)M.push([C,R,C.get_value()]);for(const[,C,R]of M)if(this._needs_invalidate(C,R)){S._invalidate_all_models();break}this._push_changes(M,L)}}getv(g){return this.property(g).get_value()}ref(){return{id:this.id}}struct(){const g={type:this.type,id:this.id,attributes:{}};return this._subtype!=null&&(g.subtype=this._subtype),g}set_subtype(g){this._subtype=g}*[Symbol.iterator](){yield*(0,o.values)(this.properties)}*syncable_properties(){for(const g of this)g.syncable&&(yield g)}serializable_attributes(){const g={};for(const L of this.syncable_properties())g[L.attr]=L.get_value();return g}static _json_record_references(g,L,A,x){const{recursive:H}=x;if((0,f.is_ref)(L)){const S=g.get_model_by_id(L.id);S==null||A.has(S)||p._value_record_references(S,A,{recursive:H})}else if((0,r.isArray)(L))for(const S of L)p._json_record_references(g,S,A,{recursive:H});else if((0,r.isPlainObject)(L))for(const S of(0,o.values)(L))p._json_record_references(g,S,A,{recursive:H})}static _value_record_references(g,L,A){const{recursive:x}=A;if(g instanceof p){if(!L.has(g)&&(L.add(g),x))for(const H of g.syncable_properties()){const S=H.get_value();p._value_record_references(S,L,{recursive:x})}}else if((0,r.isArray)(g))for(const H of g)p._value_record_references(H,L,{recursive:x});else if((0,r.isPlainObject)(g))for(const H of(0,o.values)(g))p._value_record_references(H,L,{recursive:x})}references(){const g=new Set;return p._value_record_references(this,g,{recursive:!0}),g}_doc_attached(){}_doc_detached(){}attach_document(g){if(this.document!=null&&this.document!=g)throw new Error("models must be owned by only a single document");this.document=g,this._doc_attached()}detach_document(){this._doc_detached(),this.document=null}_needs_invalidate(g,L){const A=new Set;p._value_record_references(L,A,{recursive:!1});const x=new Set;p._value_record_references(g,x,{recursive:!1});for(const H of A)if(!x.has(H))return!0;for(const H of x)if(!A.has(H))return!0;return!1}_push_changes(g,L={}){if(!this.is_syncable)return;const{document:A}=this;if(A==null)return;const{setter_id:x}=L,H=[];for(const[S,M,C]of g)S.syncable&&H.push(new a.ModelChangedEvent(A,this,S.attr,M,C,x));if(H.length!=0){let S;H.length==1?[S]=H:S=new a.DocumentEventBatch(A,H,x),A._trigger_on_change(S)}}on_change(g,L){for(const A of(0,r.isArray)(g)?g:[g])this.connect(A.change,L)}}t.HasProps=p,(b=p).prototype._props={},b.prototype._mixins=[]},function(T,V,t,k,E){k();const v=T(16),b=T(9);class w{constructor(s,a){this.sender=s,this.name=a}connect(s,a=null){d.has(this.sender)||d.set(this.sender,[]);const c=d.get(this.sender);if(i(c,this,s,a)!=null)return!1;const l=a??s;u.has(l)||u.set(l,[]);const Q=u.get(l),m={signal:this,slot:s,context:a};return c.push(m),Q.push(m),!0}disconnect(s,a=null){const c=d.get(this.sender);if(c==null||c.length===0)return!1;const l=i(c,this,s,a);if(l==null)return!1;const Q=a??s,m=u.get(Q);return l.signal=null,r(c),r(m),!0}emit(s){var a;const c=(a=d.get(this.sender))!==null&&a!==void 0?a:[];for(const{signal:l,slot:Q,context:m}of c)l===this&&Q.call(m,s,this.sender)}}t.Signal=w,w.__name__="Signal";class f extends w{emit(){super.emit(void 0)}}t.Signal0=f,f.__name__="Signal0",function(e){function s(Q,m){const p=d.get(Q);if(p==null||p.length===0)return;const y=u.get(m);if(y!=null&&y.length!==0){for(const g of y){if(g.signal==null)return;g.signal.sender===Q&&(g.signal=null)}r(p),r(y)}}function a(Q){var m;const p=d.get(Q);if(p!=null&&p.length!==0){for(const y of p){if(y.signal==null)return;const g=(m=y.context)!==null&&m!==void 0?m:y.slot;y.signal=null,r(u.get(g))}r(p)}}function c(Q,m,p){const y=u.get(Q);if(y!=null&&y.length!==0){for(const g of y){if(g.signal==null)return;if(m!=null&&g.slot!=m)continue;const L=g.signal.sender;p!=null&&p.has(L)||(g.signal=null,r(d.get(L)))}r(y)}}function l(Q){const m=d.get(Q);if(m!=null&&m.length!==0){for(const y of m)y.signal=null;r(m)}const p=u.get(Q);if(p!=null&&p.length!==0){for(const y of p)y.signal=null;r(p)}}e.disconnect_between=s,e.disconnect_sender=a,e.disconnect_receiver=c,e.disconnect_all=l,e.disconnectBetween=s,e.disconnectSender=a,e.disconnectReceiver=c,e.disconnectAll=l}(w||(t.Signal=w={})),t.Signalable=function(){return class{connect(e,s){return e.connect(s,this)}disconnect(e,s){return e.disconnect(s,this)}}};const d=new WeakMap,u=new WeakMap;function i(e,s,a,c){return(0,b.find)(e,l=>l.signal===s&&l.slot===a&&l.context===c)}const o=new Set;function r(e){o.size===0&&(async()=>(await(0,v.defer)(),function(){for(const s of o)(0,b.remove_by)(s,a=>a.signal==null);o.clear()}()))(),o.add(e)}},function(T,V,t,k,E){k();const v=new MessageChannel,b=new Map;v.port1.onmessage=f=>{const d=f.data,u=b.get(d);if(u!=null)try{u()}finally{b.delete(d)}};let w=1;t.defer=function(){return new Promise(f=>{const d=w++;b.set(d,f),v.port2.postMessage(d)})},t.wait=function(f){return new Promise(d=>setTimeout(d,f))}},function(T,V,t,k,E){k();const v=T(8),b=T(13);t.is_ref=function(w){if((0,v.isPlainObject)(w)){const f=(0,b.keys)(w);return f.length==1&&f[0]=="id"}return!1}},function(T,V,t,k,E){k(),t.YCoordinateSeqSeqSeqSpec=t.XCoordinateSeqSeqSeqSpec=t.YCoordinateSeqSpec=t.XCoordinateSeqSpec=t.YCoordinateSpec=t.XCoordinateSpec=t.CoordinateSeqSeqSeqSpec=t.CoordinateSeqSpec=t.CoordinateSpec=t.BaseCoordinateSpec=t.NumberUnitsSpec=t.UnitsSpec=t.DataSpec=t.VectorSpec=t.TextBaselineScalar=t.TextAlignScalar=t.FontStyleScalar=t.FontSizeScalar=t.FontScalar=t.LineDashScalar=t.LineCapScalar=t.LineJoinScalar=t.ArrayScalar=t.NullStringScalar=t.StringScalar=t.NumberScalar=t.ColorScalar=t.AnyScalar=t.ScalarSpec=t.VerticalAlign=t.UpdateMode=t.TooltipAttachment=t.TickLabelOrientation=t.TextureRepetition=t.TextBaseline=t.TextAlign=t.TapBehavior=t.StepMode=t.StartEnd=t.SpatialUnits=t.Sort=t.SizingMode=t.Side=t.RoundingFunction=t.ResetPolicy=t.RenderMode=t.RenderLevel=t.RadiusDimension=t.PointPolicy=t.Place=void 0,t.TextBaselineSpec=t.TextAlignSpec=t.FontStyleSpec=t.FontSizeSpec=t.FontSpec=t.LineDashSpec=t.LineCapSpec=t.LineJoinSpec=t.MarkerSpec=t.ArraySpec=t.NullStringSpec=t.StringSpec=t.AnySpec=t.NDArraySpec=t.ColorSpec=t.ScreenSizeSpec=t.NumberSpec=t.IntSpec=t.BooleanSpec=t.NullDistanceSpec=t.DistanceSpec=t.AngleSpec=void 0;const v=T(1),b=T(15),w=T(19),f=(0,v.__importStar)(T(20)),d=T(24),u=T(9),i=T(12),o=T(10),r=T(22),e=T(27),s=T(8),a=T(28),c=T(29),l=T(33);function Q(K){try{return JSON.stringify(K)}catch{return K.toString()}}function m(K){return(0,s.isPlainObject)(K)&&(K.value===void 0?0:1)+(K.field===void 0?0:1)+(K.expr===void 0?0:1)==1}E("Uniform",l.Uniform),E("UniformScalar",l.UniformScalar),E("UniformVector",l.UniformVector),t.isSpec=m;class p{constructor(Y,pt,J,st,ht,At={}){var Nt;let X;if(this.obj=Y,this.attr=pt,this.kind=J,this.default_value=st,this._dirty=!1,this.change=new b.Signal0(this.obj,"change"),this.internal=(Nt=At.internal)!==null&&Nt!==void 0&&Nt,this.convert=At.convert,this.on_update=At.on_update,ht!==void 0)X=ht,this._dirty=!0;else{const ct=this._default_override();if(ct!==void 0)X=ct;else{if(st===void 0)return void(this.spec={value:null});X=st(Y)}}this._update(X)}get is_value(){return this.spec.value!==void 0}get syncable(){return!this.internal}get_value(){return this.spec.value}set_value(Y){this._update(Y),this._dirty=!0}_default_override(){}get dirty(){return this._dirty}_update(Y){var pt;if(this.validate(Y),this.convert!=null){const J=this.convert(Y);J!==void 0&&(Y=J)}this.spec={value:Y},(pt=this.on_update)===null||pt===void 0||pt.call(this,Y,this.obj)}toString(){return`Prop(${this.obj}.${this.attr}, spec: ${Q(this.spec)})`}normalize(Y){return Y}validate(Y){if(!this.valid(Y))throw new Error(`${this.obj}.${this.attr} given invalid value: ${Q(Y)}`)}valid(Y){return this.kind.valid(Y)}_value(Y=!0){if(!this.is_value)throw new Error("attempted to retrieve property value for property without value specification");let pt=this.normalize([this.spec.value])[0];return this.spec.transform!=null&&Y&&(pt=this.spec.transform.compute(pt)),pt}}t.Property=p,p.__name__="Property";class y{constructor(Y){this.attr=Y}}t.PropertyAlias=y,y.__name__="PropertyAlias",t.Alias=function(K){return new y(K)};class g extends p{}t.PrimitiveProperty=g,g.__name__="PrimitiveProperty";class L extends p{}t.Any=L,L.__name__="Any";class A extends p{valid(Y){return(0,s.isArray)(Y)||(0,s.isTypedArray)(Y)}}t.Array=A,A.__name__="Array";class x extends p{valid(Y){return(0,s.isBoolean)(Y)}}t.Boolean=x,x.__name__="Boolean";class H extends p{valid(Y){return(0,r.is_Color)(Y)}}t.Color=H,H.__name__="Color";class S extends p{}t.Instance=S,S.__name__="Instance";class M extends p{valid(Y){return(0,s.isNumber)(Y)}}t.Number=M,M.__name__="Number";class C extends M{valid(Y){return(0,s.isNumber)(Y)&&(0|Y)==Y}}t.Int=C,C.__name__="Int";class R extends M{}t.Angle=R,R.__name__="Angle";class D extends M{valid(Y){return(0,s.isNumber)(Y)&&0<=Y&&Y<=1}}t.Percent=D,D.__name__="Percent";class B extends p{valid(Y){return(0,s.isString)(Y)}}t.String=B,B.__name__="String";class z extends p{valid(Y){return Y===null||(0,s.isString)(Y)}}t.NullString=z,z.__name__="NullString";class N extends B{}t.FontSize=N,N.__name__="FontSize";class I extends B{_default_override(){return a.settings.dev?"Bokeh":void 0}}t.Font=I,I.__name__="Font";class O extends p{valid(Y){return(0,s.isString)(Y)&&(0,u.includes)(this.enum_values,Y)}}function G(K){return class extends O{get enum_values(){return[...K]}}}t.EnumProperty=O,O.__name__="EnumProperty",t.Enum=G;class q extends O{get enum_values(){return[...f.Direction]}normalize(Y){const pt=new Uint8Array(Y.length);for(let J=0;J<Y.length;J++)switch(Y[J]){case"clock":pt[J]=0;break;case"anticlock":pt[J]=1}return pt}}t.Direction=q,q.__name__="Dire