From 84079e6ae52652373d4f6d18273a17e7651136f6 Mon Sep 17 00:00:00 2001 From: <> Date: Thu, 29 Aug 2024 21:54:27 +0000 Subject: [PATCH] Update documentation --- contributing/contributing.html | 16 +- examples/balanced_field/balanced_field.html | 69 ++++---- .../balanced_field_funccomp.html | 28 ++-- examples/brachistochrone/brachistochrone.html | 48 +++--- .../brachistochrone_tandem_phases.html | 30 ++-- .../brachistochrone_upstream_controls.html | 8 +- ...ochrone_upstream_init_duration_states.html | 14 +- .../brachistochrone_upstream_states.html | 10 +- examples/bryson_denham/bryson_denham.html | 86 +++++----- .../cannonball_implicit_duration.html | 61 +++---- examples/cart_pole/cart_pole.html | 38 ++--- .../commercial_aircraft.html | 98 ++++++------ .../double_integrator/double_integrator.html | 36 ++--- .../finite_burn_orbit_raise.html | 38 ++--- examples/hull/hull_problem.html | 46 +++--- examples/hypersensitive/hypersensitive.html | 150 +++++++++--------- .../length_constrained_brachistochrone.html | 12 +- examples/min_time_climb/min_time_climb.html | 38 ++--- examples/moon_landing/moon_landing.html | 74 ++++----- examples/mountain_car/mountain_car.html | 92 +++++------ .../multi_phase_cannonball.html | 59 ++++--- .../multibranch_trajectory.html | 8 +- examples/racecar/racecar.html | 15 +- examples/reentry/reentry.html | 46 +++--- .../robertson_problem/robertson_problem.html | 8 +- examples/ssto_earth/ssto_earth.html | 47 +++--- .../ssto_moon_linear_tangent.html | 24 +-- .../ssto_moon_polynomial_controls.html | 26 +-- examples/vanderpol/vanderpol.html | 119 +++++++------- examples/water_rocket/water_rocket.html | 40 ++--- faq/connect_scalar_parameters_to_ode.html | 10 +- faq/tandem_phases.html | 24 +-- faq/use_partial_coloring.html | 66 ++++---- features/phases/analytic_phases.html | 20 +-- features/phases/constraints.html | 8 +- features/phases/phases.html | 8 +- features/trajectories/trajectories.html | 4 +- getting_started/collocation.html | 24 +-- getting_started/defining_odes.html | 4 +- getting_started/intro_to_dymos/intro_ivp.html | 8 +- getting_started/optimal_control.html | 12 +- searchindex.js | 2 +- 42 files changed, 786 insertions(+), 788 deletions(-) diff --git a/contributing/contributing.html b/contributing/contributing.html index d06a23a0e..8413a9721 100644 --- a/contributing/contributing.html +++ b/contributing/contributing.html @@ -1055,21 +1055,21 @@
Both sets of equations of motion have common aerodynamic models.
First, the lift coefficient is computed using a model which assumes linearity in lift wrt the angle of attack.
-Next, the drag-due-to-lift factor is computed (Equations 12.48 and 12.61 in Raymer[@raymer2012aircraft]).
-Finally, the lift and drag are computed after computing the dynamic pressure.
-The runway equations of motion are used to integrate range and speed as the vehicle rolls along the runway.
-The flight equations of motion include two additional state variables: the flight-path angle (\(\gamma\)) and altitude (\(h\)).
-<dymos.phase.phase.Phase at 0x7f154eb8f450>
+<dymos.phase.phase.Phase at 0x7f3cba011890>
Coloring for 'traj.phases.rto.rhs_all' (class BalancedFieldODEComp)
+Time to compute sparsity: 0.0163 sec
+Time to compute coloring: 0.0103 sec
+Memory to compute coloring: 0.1250 MB
+
+Coloring for 'traj.phases.rto.rhs_all' (class BalancedFieldODEComp)
Jacobian shape: (132, 60) (10.13% nonzero)
FWD solves: 16 REV solves: 0
Total colors vs. total size: 16 vs 60 (73.33% improvement)
Sparsity computed using tolerance: 1e-25
-Time to compute sparsity: 0.0165 sec
-Time to compute coloring: 0.0102 sec
+Time to compute sparsity: 0.0159 sec
+Time to compute coloring: 0.0099 sec
Memory to compute coloring: 0.0000 MB
Coloring for 'traj.phases.v1_to_vr.rhs_all' (class BalancedFieldODEComp)
@@ -1756,8 +1755,8 @@ Building and running the problemFull total jacobian for problem 'problem' was computed 3 times, taking 0.9892934480000122 seconds.
+Full total jacobian for problem 'problem' was computed 3 times, taking 0.9905034299999897 seconds.
Total jacobian shape: (178, 166)
@@ -1792,10 +1791,10 @@ Building and running the problem/usr/share/miniconda/envs/test/lib/python3.11/site-packages/openmdao/core/total_jac.py:1646: DerivativesWarning:Constraints or objectives [('traj.phases.climb->path_constraint->gam', inds=[(0, 0)])] cannot be impacted by the design variables of the problem.
@@ -1816,11 +1815,11 @@ Building and running the problemFull total jacobian for problem 'problem' was computed 3 times, taking 3.245863141999962 seconds.
+Full total jacobian for problem 'problem' was computed 3 times, taking 3.2553110800000127 seconds.
Total jacobian shape: (178, 166)
@@ -1332,10 +1332,10 @@ Building and running the problem/usr/share/miniconda/envs/test/lib/python3.11/site-packages/openmdao/core/total_jac.py:1646: DerivativesWarning:Constraints or objectives [('traj.phases.climb->path_constraint->gam', inds=[(0, 0)])] cannot be impacted by the design variables of the problem.
diff --git a/examples/brachistochrone/brachistochrone.html b/examples/brachistochrone/brachistochrone.html
index 7cd8755bf..4a9d58139 100644
--- a/examples/brachistochrone/brachistochrone.html
+++ b/examples/brachistochrone/brachistochrone.html
@@ -866,8 +866,8 @@ State variables
System dynamics#
From the free-body diagram above, the evolution of the state variables is given by the following ordinary differential equations (ODE).
-
-(13)#\[\begin{align}
+
+(13)#\[\begin{align}
\frac{d x}{d t} &= v \sin(\theta) \\
\frac{d y}{d t} &= -v \cos(\theta) \\
\frac{d v}{d t} &= g \cos(\theta)
@@ -885,8 +885,8 @@ The initial and final conditions
-(14)#\[\begin{align}
+
+(14)#\[\begin{align}
x_0 &= 0 \\
y_0 &= 10 \\
v_0 &= 0
@@ -894,8 +894,8 @@ The initial and final conditions
-(15)#\[\begin{align}
+
+(15)#\[\begin{align}
x_f &= 10 \\
y_f &= 5 \\
v_f &= \mathrm{free}
@@ -1061,27 +1061,27 @@ Testing the ODEFull total jacobian for problem 'problem2' was computed 3 times, taking 0.022176542000011068 seconds.
+Full total jacobian for problem 'problem2' was computed 3 times, taking 0.02187642000001233 seconds.
Total jacobian shape: (40, 50)
-
-
-Jacobian shape: (40, 50) (13.40% nonzero)
+
+
+Jacobian shape: (40, 50) (13.40% nonzero)
FWD solves: 8 REV solves: 0
Total colors vs. total size: 8 vs 50 (84.00% improvement)
Sparsity computed using tolerance: 1e-25
-Time to compute sparsity: 0.0222 sec
-Time to compute coloring: 0.0222 sec
-Memory to compute coloring: 0.2500 MB
-Coloring created on: 2024-08-23 12:47:53
+Time to compute sparsity: 0.0219 sec
+Time to compute coloring: 0.0219 sec
+Memory to compute coloring: 0.3750 MB
+Coloring created on: 2024-08-29 21:45:23
-Full total jacobian for problem 'problem5' was computed 3 times, taking 0.014141011999981856 seconds.
+Full total jacobian for problem 'problem5' was computed 3 times, taking 0.01422202099996639 seconds.
Total jacobian shape: (12, 51)
No coloring was computed successfully.
diff --git a/examples/brachistochrone/brachistochrone_tandem_phases.html b/examples/brachistochrone/brachistochrone_tandem_phases.html
index b5eeb525c..8899aee86 100644
--- a/examples/brachistochrone/brachistochrone_tandem_phases.html
+++ b/examples/brachistochrone/brachistochrone_tandem_phases.html
@@ -994,7 +994,7 @@ Setup and runModel viewer data has already been recorded for Driver.
-Full total jacobian for problem 'problem' was computed 3 times, taking 0.15956027599997924 seconds.
+Full total jacobian for problem 'problem' was computed 3 times, taking 0.16103897199997164 seconds.
Total jacobian shape: (223, 287)
@@ -1003,10 +1003,10 @@ Setup and run/usr/share/miniconda/envs/test/lib/python3.11/site-packages/openmdao/visualization/opt_report/opt_report.py:625: UserWarning: Attempting to set identical low and high ylims makes transformation singular; automatically expanding.
@@ -1280,7 +1280,7 @@ Plots#
function _(t,_,n,o,r){o();t(1).__exportStar(t(2),n),t(76)},
function _(e,t,r,n,o){n();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)}r.__extends=i;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){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{s(n.next(e))}catch(e){a(e)}}function c(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,c)}s((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=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 d(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 h(){for(var e=[],t=0;t1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof w?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 g(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:w(e[n](t)),done:!1}:o?o(t):t}:o}}function O(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=_(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 j(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;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===s?{get:l.get,set:l.set}:l[u],_);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},r.__runInitializers=function(e,t,r){for(var n=arguments.length>2,o=0;o{(0,b.assert)(e instanceof z.ModelEvent),this.event_manager.trigger(e)}))}[f.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 S.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 S.LODStart)),this._interactive_finalize=t,this._interactive_timestamp=Date.now()}interactive_stop(){null!=this._interactive_plot&&(this._interactive_plot.trigger_event(new S.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._all_models_freeze_count+=1}_pop_all_models_freeze(){this._all_models_freeze_count-=1,0===this._all_models_freeze_count&&this._recompute_all_models()}_invalidate_all_models(){r.logger.debug("invalidating document models"),0===this._all_models_freeze_count&&this._recompute_all_models()}_recompute_all_models(){let e=new Set;for(const t of this._roots)e=p.union(e,t.references());const t=new Set(this._all_models.values()),s=p.difference(t,e),o=p.difference(e,t),n=new Map;for(const t of e)n.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=n}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 E.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 E.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 E.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 E.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,w.execute)(s,this,e)}on_event(e,...t){const s=(0,u.isString)(e)?e:e.prototype.event_name,o=this._document_callbacks.get(s)??[],n=t;this._document_callbacks.set(s,[...o,...n])}to_json_string(e=!0){return JSON.stringify(this.to_json(e))}to_json(e=!0){const t=new c.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 M.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=d.Version.from(t),o=d.Version.from(l.version),n=`new document using Bokeh ${t} and BokehJS ${l.version}`;(0,f.is_equal)(s,o)?r.logger.debug(n):r.logger.warn(`Bokeh/BokehJS version mismatch: ${n}`)}static from_json(e,t){r.logger.debug("Creating Document from JSON"),M._handle_version(e);const s=new a.ModelResolver(_.default_resolver);if(null!=e.defs){new h.Deserializer(s).decode(e.defs)}const o=new M({resolver:s});o._push_all_models_freeze();const n=e=>t?.push(e);o.on_change(n,!0);const i=new h.Deserializer(s,o._all_models,(e=>e.attach_document(o))),l=i.decode(e.roots),c=null!=e.callbacks?i.decode(e.callbacks):{};o.remove_on_change(n);for(const[e,t]of(0,v.entries)(c))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){M.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 c.Serializer({references:t,binary:!0}).encode(e)};return this._new_models.clear(),s}apply_json_patch(e,t=new Map){this._push_all_models_freeze();const s=new h.Deserializer(this._resolver,this._all_models,(e=>e.attach_document(this))).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:n}=e;if(null!=n){const e=(0,v.dict)(o),n=(0,v.dict)(t.property(s).get_value());for(const[t,s]of n)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:n}=e,i=t.property(s);t.stream_to(i,o,n,{sync:!1});break}case"ColumnsPatched":{const{model:t,attr:s,patches:o}=e,n=t.property(s);t.patch_to(n,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}'`)}this._pop_all_models_freeze()}}s.Document=M,M.__name__="Document"},
@@ -1350,7 +1350,7 @@ Plots#
function _(t,e,r,i,n){i();const s=t(24),h=t(26),o=t(13),c=t(8),{min:u,max:x,round:y}=Math;function g(t,e){return isNaN(t)?e:isNaN(e)?t:u(t,e)}function a(t,e){return isNaN(t)?e:isNaN(e)?t:x(t,e)}r.empty=function(){return{x0:1/0,y0:1/0,x1:-1/0,y1:-1/0}},r.positive_x=function(){return{x0:Number.MIN_VALUE,y0:-1/0,x1:1/0,y1:1/0}},r.positive_y=function(){return{x0:-1/0,y0:Number.MIN_VALUE,x1:1/0,y1:1/0}},r.union=function(t,e){return{x0:g(t.x0,e.x0),x1:a(t.x1,e.x1),y0:g(t.y0,e.y0),y1:a(t.y1,e.y1)}},r.isXY=function(t){return(0,c.isPlainObject)(t)&&"x"in t&&"y"in t};class _{constructor(t,e=!1){if(null==t)this.x0=0,this.y0=0,this.x1=0,this.y1=0;else if("x0"in t){const{x0:e,y0:r,x1:i,y1:n}=t;if(isFinite(e+r+i+n)){if(!(e<=i&&r<=n))throw new Error(`invalid bbox {x0: ${e}, y0: ${r}, x1: ${i}, y1: ${n}}`);this.x0=e,this.y0=r,this.x1=i,this.y1=n}else this.x0=NaN,this.y0=NaN,this.x1=NaN,this.y1=NaN}else if("x"in t){const{x:e,y:r,width:i,height:n,origin:s="top_left"}=t;if(!(i>=0&&n>=0))throw new Error(`invalid bbox {x: ${e}, y: ${r}, width: ${i}, height: ${n}}`);const h=(()=>{switch(s){case"left":return"center_left";case"right":return"center_right";case"top":return"top_center";case"bottom":return"bottom_center";case"center":return"center_center";default:return s}})(),[o,c]=h.split("_",2),u=(()=>{switch(o){case"top":return 0;case"center":return.5;case"bottom":return 1}})(),x=e-(()=>{switch(c){case"left":return 0;case"center":return.5;case"right":return 1}})()*i,y=r-u*n,g=x+i,a=y+n;this.x0=x,this.y0=y,this.x1=g,this.y1=a}else{let r,i,n,s;if("width"in t)if("left"in t)r=t.left,i=r+t.width;else if("right"in t)i=t.right,r=i-t.width;else{const e=t.width/2;r=t.hcenter-e,i=t.hcenter+e}else r=t.left,i=t.right;if("height"in t)if("top"in t)n=t.top,s=n+t.height;else if("bottom"in t)s=t.bottom,n=s-t.height;else{const e=t.height/2;n=t.vcenter-e,s=t.vcenter+e}else n=t.top,s=t.bottom;if(r>i||n>s){if(!e)throw new Error(`invalid bbox {left: ${r}, top: ${n}, right: ${i}, bottom: ${s}}`);r>i&&(r=i),n>s&&(n=s)}this.x0=r,this.y0=n,this.x1=i,this.y1=s}}static from_lrtb({left:t,right:e,top:r,bottom:i}){return new _({x0:u(t,e),y0:u(r,i),x1:x(t,e),y1:x(r,i)})}static from_rect({x0:t,y0:e,x1:r,y1:i}){return new _({x0:u(t,r),y0:u(e,i),x1:x(t,r),y1:x(e,i)})}static empty(){return new _({x0:0,y0:0,x1:0,y1:0})}static invalid(){return new _({x0:NaN,y0:NaN,x1:NaN,y1:NaN})}clone(){return new _(this)}equals(t){return this.x0==t.x0&&this.y0==t.y0&&this.x1==t.x1&&this.y1==t.y1}[h.equals](t,e){return e.eq(this.x0,t.x0)&&e.eq(this.y0,t.y0)&&e.eq(this.x1,t.x1)&&e.eq(this.y1,t.y1)}toString(){return`BBox({left: ${this.left}, top: ${this.top}, width: ${this.width}, height: ${this.height}})`}get is_valid(){const{x0:t,x1:e,y0:r,y1:i}=this;return isFinite(t+e+r+i)}get is_empty(){const{x0:t,x1:e,y0:r,y1:i}=this;return 0==t&&0==e&&0==r&&0==i}get left(){return this.x0}get top(){return this.y0}get right(){return this.x1}get bottom(){return this.y1}get p0(){return{x:this.x0,y:this.y0}}get p1(){return{x:this.x1,y:this.y1}}get x(){return this.x0}get y(){return this.y0}get width(){return this.x1-this.x0}get height(){return this.y1-this.y0}get size(){return{width:this.width,height:this.height}}get rect(){const{x0:t,y0:e,x1:r,y1:i}=this;return{p0:{x:t,y:e},p1:{x:r,y:e},p2:{x:r,y:i},p3:{x:t,y:i}}}get box(){const{x:t,y:e,width:r,height:i}=this;return{x:t,y:e,width:r,height:i}}get lrtb(){const{left:t,right:e,top:r,bottom:i}=this;return{left:t,right:e,top:r,bottom:i}}get x_range(){return{start:this.x0,end:this.x1}}get y_range(){return{start:this.y0,end:this.y1}}get h_range(){return this.x_range}get v_range(){return this.y_range}get ranges(){return[this.x_range,this.y_range]}get aspect(){return this.width/this.height}get x_center(){return(this.left+this.right)/2}get y_center(){return(this.top+this.bottom)/2}get hcenter(){return this.x_center}get vcenter(){return this.y_center}get area(){return this.width*this.height}resolve(t){switch(t){case"top_left":return this.top_left;case"top_center":return this.top_center;case"top_right":return this.top_right;case"center_left":return this.center_left;case"center_center":return this.center_center;case"center_right":return this.center_right;case"bottom_left":return this.bottom_left;case"bottom_center":return this.bottom_center;case"bottom_right":return this.bottom_right;case"center":return this.center;case"top":return this.top;case"left":return this.left;case"right":return this.right;case"bottom":return this.bottom;case"width":return this.width;case"height":return this.height;default:return{x:NaN,y:NaN}}}get top_left(){return{x:this.left,y:this.top}}get top_center(){return{x:this.hcenter,y:this.top}}get top_right(){return{x:this.right,y:this.top}}get center_left(){return{x:this.left,y:this.vcenter}}get center_center(){return{x:this.hcenter,y:this.vcenter}}get center_right(){return{x:this.right,y:this.vcenter}}get bottom_left(){return{x:this.left,y:this.bottom}}get bottom_center(){return{x:this.hcenter,y:this.bottom}}get bottom_right(){return{x:this.right,y:this.bottom}}get center(){return{x:this.hcenter,y:this.vcenter}}round(){return new _({x0:y(this.x0),x1:y(this.x1),y0:y(this.y0),y1:y(this.y1)})}relative(){const{width:t,height:e}=this;return new _({x:0,y:0,width:t,height:e})}translate(t,e){const{x:r,y:i,width:n,height:s}=this;return new _({x:t+r,y:e+i,width:n,height:s})}scale(t){return new _({x0:this.x0*t,x1:this.x1*t,y0:this.y0*t,y1:this.y1*t})}relativize(t,e){return[t-this.x,e-this.y]}contains(t,e){return this.x0<=t&&t<=this.x1&&this.y0<=e&&e<=this.y1}clip(t,e){return tthis.x1&&(t=this.x1),ethis.y1&&(e=this.y1),[t,e]}grow_by(t){return new _({left:this.left-t,right:this.right+t,top:this.top-t,bottom:this.bottom+t})}shrink_by(t){return new _({left:this.left+t,right:this.right-t,top:this.top+t,bottom:this.bottom-t},!0)}union(t){return new _({x0:u(this.x0,t.x0),y0:u(this.y0,t.y0),x1:x(this.x1,t.x1),y1:x(this.y1,t.y1)})}intersection(t){return this.intersects(t)?new _({x0:x(this.x0,t.x0),y0:x(this.y0,t.y0),x1:u(this.x1,t.x1),y1:u(this.y1,t.y1)}):null}intersects(t){return!(t.x1this.x1||t.y1this.y1)}get x_screen(){const t=this;return this._x_screen??(this._x_screen={compute:e=>t.left+e,invert:e=>e-t.left,v_compute(e){const{left:r}=t;return new s.ScreenArray((0,o.map)(e,(t=>r+t)))},v_invert(e){const{left:r}=t;return(0,o.map)(e,(t=>t-r))},get source_range(){return t.x_range},get target_range(){return t.x_range}})}get y_screen(){const t=this;return this._y_screen??(this._y_screen={compute:e=>t.top+e,invert:e=>e-t.top,v_compute(e){const{top:r}=t;return new s.ScreenArray((0,o.map)(e,(t=>r+t)))},v_invert(e){const{top:r}=t;return(0,o.map)(e,(t=>t-r))},get source_range(){return t.y_range},get target_range(){return t.y_range}})}get x_view(){const t=this;return this._x_view??(this._x_view={compute:e=>t.left+e,invert:e=>e-t.left,v_compute(e){const{left:r}=t;return new s.ScreenArray((0,o.map)(e,(t=>r+t)))},v_invert(e){const{left:r}=t;return(0,o.map)(e,(t=>t-r))},get source_range(){return t.x_range},get target_range(){return t.x_range}})}get y_view(){const t=this;return this._y_view??(this._y_view={compute:e=>t.bottom-e,invert:e=>t.bottom-e,v_compute(e){const{bottom:r}=t;return new s.ScreenArray((0,o.map)(e,(t=>r-t)))},v_invert(e){const{bottom:r}=t;return(0,o.map)(e,(t=>r-t))},get source_range(){return t.y_range},get target_range(){return{start:t.bottom,end:t.top}}})}get xview(){return this.x_view}get yview(){return this.y_view}}r.BBox=_,_.__name__="BBox"},
function _(n,t,e,o,r){o();const s=n(19),i=n(9),c=n(8),l=document.createElement("div").style;function f(n){if(n.startsWith("--"))return n;const t=n.replaceAll(/_/g,"-").replaceAll(/[A-Z]/g,(n=>`-${n.toLowerCase()}`));if(t in l)return t;const e=`-webkit-${t}`;if(e in l)return e;const o=`-moz-${t}`;return o in l?o:(s.logger.warn(`unknown CSS property '${n}'`),null)}function*u(n){if((0,c.isPlainObject)(n)||n instanceof Map)for(const[t,e]of(0,i.entries)(n)){const n=f(t);null!=n&&(yield[n,e])}else for(const t of n.own_properties())if(t.dirty){const n=f(t.attr);null!=n&&(yield[n,t.get_value()])}}e.apply_styles=function(n,t){for(const[e,o]of u(t))(0,c.isString)(o)?n.setProperty(e,o):n.removeProperty(e)},e.compose_stylesheet=function(n){const t=[];for(const[e,o]of(0,i.entries)(n)){t.push(`${e} {`);for(const[n,e]of u(o))(0,c.isString)(e)&&0!=e.length&&t.push(` ${n}: ${e};`);t.push("}")}return t.join("\n")}},
function _(e,o,i,n,t){n(),i.default=":host{--base-font:var(--bokeh-base-font, Helvetica, Arial, sans-serif);--mono-font:var(--bokeh-mono-font, monospace);--font-size:var(--bokeh-font-size, 12px);--line-height:calc(20 / 14);--line-height-computed:calc(var(--font-size) * var(--line-height));--border-radius:4px;--padding-vertical:6px;--padding-horizontal:12px;--bokeh-top-level:10000;}:host{box-sizing:border-box;font-family:var(--base-font);font-size:var(--font-size);line-height:var(--line-height);}*,*:before,*:after{box-sizing:inherit;font-family:inherit;}pre,code{font-family:var(--mono-font);margin:0;}"},
-function _(n,t,o,e,s){e();const a=n(68),c=n(19),r=n(54);o._get_ws_url=function(n,t){let o,e="ws:";return"https:"==window.location.protocol&&(e="wss:"),null!=t?(o=document.createElement("a"),o.href=t):o=window.location,null!=n?"/"==n&&(n=""):n=o.pathname.replace(/\/+$/,""),`${e}//${o.host}${n}/ws`};const i=new Map;o.add_document_from_session=async function(n,t,o,e=[],s=!1){const l=window.location.search.substring(1);let d;try{d=await function(n,t,o){const e=(0,a.parse_token)(t).session_id;i.has(n)||i.set(n,new Map);const s=i.get(n);return s.has(e)||s.set(e,(0,a.pull_session)(n,t,o)),s.get(e)}(n,t,l)}catch(n){const o=(0,a.parse_token)(t).session_id;throw c.logger.error(`Failed to load Bokeh session ${o}: ${n}`),n}return(0,r.add_document_standalone)(d.document,o,e,s)}},
+function _(e,t,n,o,s){o();const a=e(68),r=e(19),l=e(54);n._get_ws_url=function(e,t){let n;void 0===t&&function(e){if(null===e)return!1;if("IFRAME"===e.tagName.toUpperCase())return!0;return!1}(frameElement)&&void 0!==frameElement.dataset.absoluteUrl&&(t=frameElement.dataset.absoluteUrl),null!=t?(n=document.createElement("a"),n.href=t):n=window.location;const o="https:"==n.protocol?"wss:":"ws:";return null!=e?"/"==e&&(e=""):e=n.pathname.replace(/\/+$/,""),`${o}//${n.host}${e}/ws`};const c=new Map;n.add_document_from_session=async function(e,t,n,o=[],s=!1){const i=window.location.search.substring(1);let u;try{u=await function(e,t,n){const o=(0,a.parse_token)(t).session_id;c.has(e)||c.set(e,new Map);const s=c.get(e);return s.has(o)||s.set(o,(0,a.pull_session)(e,t,n)),s.get(o)}(e,t,i)}catch(e){const n=(0,a.parse_token)(t).session_id;throw r.logger.error(`Failed to load Bokeh session ${n}: ${e}`),e}return(0,l.add_document_standalone)(u.document,n,o,s)}},
function _(e,s,n,t,o){t();const r=e(19),i=e(5),l=e(69),c=e(70),_=e(71);n.DEFAULT_SERVER_WEBSOCKET_URL="ws://localhost:5006/ws",n.DEFAULT_TOKEN="eyJzZXNzaW9uX2lkIjogImRlZmF1bHQifQ";let h=0;function a(e){let s=e.split(".")[0];const n=s.length%4;return 0!=n&&(s+="=".repeat(4-n)),JSON.parse(atob(s.replace(/_/g,"/").replace(/-/g,"+")))}n.parse_token=a;class d{constructor(e=n.DEFAULT_SERVER_WEBSOCKET_URL,s=n.DEFAULT_TOKEN,t=null){this._number=h++,this.socket=null,this.session=null,this.closed_permanently=!1,this._current_handler=null,this._pending_replies=new Map,this._pending_messages=[],this._receiver=new c.Receiver,this.url=e,this.token=s,this.args_string=t,this.id=a(s).session_id.split(".")[0],r.logger.debug(`Creating websocket ${this._number} to '${this.url}' session '${this.id}'`)}async connect(){if(this.closed_permanently)throw new Error("Cannot connect() a closed ClientConnection");if(null!=this.socket)throw new Error("Already connected");this._current_handler=null,this._pending_replies.clear(),this._pending_messages=[];try{let e=`${this.url}`;return null!=this.args_string&&this.args_string.length>0&&(e+=`?${this.args_string}`),this.socket=new WebSocket(e,["bokeh",this.token]),new Promise(((e,s)=>{this.socket.binaryType="arraybuffer",this.socket.onopen=()=>this._on_open(e,s),this.socket.onmessage=e=>this._on_message(e),this.socket.onclose=e=>this._on_close(e,s),this.socket.onerror=()=>this._on_error(s)}))}catch(e){throw r.logger.error(`websocket creation failed to url: ${this.url}`),r.logger.error(` - ${e}`),e}}close(){this.closed_permanently||(r.logger.debug(`Permanently closing websocket connection ${this._number}`),this.closed_permanently=!0,null!=this.socket&&this.socket.close(1e3,`close method called on ClientConnection ${this._number}`),this.session._connection_closed())}_schedule_reconnect(e){setTimeout((()=>{this.closed_permanently||(r.logger.info(`Websocket connection ${this._number} disconnected, will not attempt to reconnect`),this.session?.notify_connection_lost())}),e)}send(e){null!=this.socket?e.send(this.socket):r.logger.error("not connected so cannot send",e)}async send_with_reply(e){const s=await new Promise(((s,n)=>{this._pending_replies.set(e.msgid(),{resolve:s,reject:n}),this.send(e)}));if("ERROR"==s.msgtype())throw new Error(`Error reply ${s.content.text}`);return s}async _pull_doc_json(){const e=l.Message.create("PULL-DOC-REQ",{},{}),s=await this.send_with_reply(e);if(!("doc"in s.content))throw new Error("No 'doc' field in PULL-DOC-REPLY");return s.content.doc}async _repull_session_doc(e,s){r.logger.debug(null!=this.session?"Repulling session":"Pulling session for first time");try{const n=await this._pull_doc_json();if(null==this.session)if(this.closed_permanently)r.logger.debug("Got new document after connection was already closed"),s(new Error("The connection has been closed"));else{const s=[],t=i.Document.from_json(n,s);this.session=new _.ClientSession(this,t);for(const e of s)t._trigger_on_change(e);for(const e of this._pending_messages)this.session.handle(e);this._pending_messages=[],r.logger.debug("Created a new session from new pulled doc"),e(this.session)}else this.session.document.replace_with_json(n),r.logger.debug("Updated existing session with new pulled doc")}catch(e){console.trace(e),r.logger.error(`Failed to repull session ${e}`),s(e instanceof Error?e:`${e}`)}}_on_open(e,s){r.logger.info(`Websocket connection ${this._number} is now open`),this._current_handler=n=>{this._awaiting_ack_handler(n,e,s)}}_on_message(e){null==this._current_handler&&r.logger.error("Got a message with no current handler set");try{this._receiver.consume(e.data)}catch(e){this._close_bad_protocol(`${e}`)}const s=this._receiver.message;if(null!=s){const e=s.problem();null!=e&&this._close_bad_protocol(e),this._current_handler(s)}}_on_close(e,s){r.logger.info(`Lost websocket ${this._number} connection, ${e.code} (${e.reason})`),this.socket=null,this._pending_replies.forEach((e=>e.reject("Disconnected"))),this._pending_replies.clear(),this.closed_permanently||this._schedule_reconnect(2e3),s(new Error(`Lost websocket connection, ${e.code} (${e.reason})`))}_on_error(e){r.logger.debug(`Websocket error on socket ${this._number}`);const s="Could not open websocket";r.logger.error(`Failed to connect to Bokeh server: ${s}`),e(new Error(s))}_close_bad_protocol(e){r.logger.error(`Closing connection: ${e}`),null!=this.socket&&this.socket.close(1002,e)}_awaiting_ack_handler(e,s,n){"ACK"===e.msgtype()?(this._current_handler=e=>this._steady_state_handler(e),this._repull_session_doc(s,n)):this._close_bad_protocol("First message was not an ACK")}_steady_state_handler(e){const s=e.reqid(),n=this._pending_replies.get(s);null!=n?(this._pending_replies.delete(s),n.resolve(e)):null!=this.session?this.session.handle(e):"PATCH-DOC"!=e.msgtype()&&this._pending_messages.push(e)}}n.ClientConnection=d,d.__name__="ClientConnection",n.pull_session=function(e,s,n){return new d(e,s,n).connect()}},
function _(e,s,t,r,n){r();const i=e(32),a=e(40),h=e(12);class f{get buffers(){return this._buffers}constructor(e,s,t){this._buffers=new Map,this.header=e,this.metadata=s,this.content=t}static assemble(e,s,t){const r=JSON.parse(e),n=JSON.parse(s),i=JSON.parse(t);return new f(r,n,i)}assemble_buffer(e,s){const t=this.header.num_buffers??0;if(t<=this._buffers.size)throw new Error(`too many buffers received, expecting ${t}`);const{id:r}=JSON.parse(e);this._buffers.set(r,s)}static create(e,s,t){const r=f.create_header(e);return new f(r,s,t)}static create_header(e){return{msgid:(0,a.unique_id)(),msgtype:e}}complete(){const{num_buffers:e}=this.header;return null==e||this._buffers.size==e}send(e){(0,h.assert)(null==this.header.num_buffers);const s=[],t=JSON.stringify(this.content,((e,t)=>{if(t instanceof i.Buffer){const e={id:`${s.length}`};return s.push([e,t.buffer]),e}return t})),r=s.length;r>0&&(this.header.num_buffers=r);const n=JSON.stringify(this.header),a=JSON.stringify(this.metadata);e.send(n),e.send(a),e.send(t);for(const[t,r]of s)e.send(JSON.stringify(t)),e.send(r)}msgid(){return this.header.msgid}msgtype(){return this.header.msgtype}reqid(){return this.header.reqid}problem(){return"msgid"in this.header?"msgtype"in this.header?null:"No msgtype in header":"No msgid in header"}}t.Message=f,f.__name__="Message"},
function _(t,e,s,_,r){_();const i=t(69),h=t(8),a=t(12);class n{constructor(){this.message=null,this._partial=null,this._fragments=[],this._buf_header=null,this._current_consumer=this._HEADER}consume(t){this._current_consumer(t)}_HEADER(t){this._assume_text(t),this.message=null,this._partial=null,this._fragments=[t],this._buf_header=null,this._current_consumer=this._METADATA}_METADATA(t){this._assume_text(t),this._fragments.push(t),this._current_consumer=this._CONTENT}_CONTENT(t){this._assume_text(t),this._fragments.push(t);const[e,s,_]=this._fragments;(0,a.assert)(null!=e&&null!=s&&null!=_),this._partial=i.Message.assemble(e,s,_),this._check_complete()}_BUFFER_HEADER(t){this._assume_text(t),this._buf_header=t,this._current_consumer=this._BUFFER_PAYLOAD}_BUFFER_PAYLOAD(t){this._assume_binary(t),(0,a.assert)(null!=this._partial&&null!=this._buf_header),this._partial.assemble_buffer(this._buf_header,t),this._check_complete()}_assume_text(t){if(!(0,h.isString)(t))throw new Error("Expected text fragment but received binary fragment")}_assume_binary(t){if(!(t instanceof ArrayBuffer))throw new Error("Expected binary fragment but received text fragment")}_check_complete(){this._partial.complete()?(this.message=this._partial,this._current_consumer=this._HEADER):this._current_consumer=this._BUFFER_HEADER}}s.Receiver=n,n.__name__="Receiver"},
@@ -1464,7 +1464,7 @@ Plots#
function _(t,e,s,i,n){var h,o,r;i();const a=t(9),_=t(8),l=t(179),c=t(22),u=t(180),d=t(181),g=t(40),x=t(114),p=t(64),f=t(176),m=t(182);class y extends f.BaseTextView{constructor(){super(...arguments),this._position={sx:0,sy:0},this.align="left",this._x_anchor="left",this._y_anchor="center",this._base_font_size=13,this.font_size_scale=1,this.svg_image=null}graphics(){return this}infer_text_height(){return"ascent_descent"}set base_font_size(t){null!=t&&(this._base_font_size=t)}get base_font_size(){return this._base_font_size}_rect(){const{width:t,height:e}=this._size(),{x:s,y:i}=this._computed_position();return new p.BBox({x:s,y:i,width:t,height:e}).rect}set position(t){this._position=t}get position(){return this._position}get text(){return this.model.text}get provider(){return m.default_provider}async lazy_initialize(){await super.lazy_initialize(),"not_started"==this.provider.status&&await this.provider.fetch()}connect_signals(){super.connect_signals(),this.on_change(this.model.properties.text,(()=>this.load_image()))}set visuals(t){const e=t.color,s=t.alpha,i=t.font_style;let n=t.font_size;const h=t.font,{font_size_scale:o,_base_font_size:r}=this,a=(0,d.parse_css_font_size)(n);if(null!=a){let{value:t,unit:e}=a;t*=o,"em"==e&&0!=r&&(t*=r,e="px"),n=`${t}${e}`}const _=`${i} ${n} ${h}`;this.font=_,this.color=(0,c.color2css)(e,s);const l=t.align;this._x_anchor=l;const u=t.baseline;this._y_anchor=(()=>{switch(u){case"top":return"top";case"middle":return"center";case"bottom":return"bottom";default:return"baseline"}})()}_computed_position(){const{width:t,height:e}=this._size(),{sx:s,sy:i,x_anchor:n=this._x_anchor,y_anchor:h=this._y_anchor}=this.position,o=(0,d.font_metrics)(this.font);return{x:s-(()=>{if((0,_.isNumber)(n))return n*t;switch(n){case"left":return 0;case"center":return.5*t;case"right":return t}})(),y:i-(()=>{if((0,_.isNumber)(h))return h*e;switch(h){case"top":return o.height>e?e-(-this.valign-o.descent)-o.height:0;case"center":case"baseline":return.5*e;case"bottom":return o.height>e?e+o.descent+this.valign:e}})()}}size(){const{width:t,height:e}=this._size(),{angle:s}=this;if(null==s||0==s)return{width:t,height:e};{const i=Math.cos(Math.abs(s)),n=Math.sin(Math.abs(s));return{width:Math.abs(t*i+e*n),height:Math.abs(t*n+e*i)}}}get_image_dimensions(){const t=(0,d.font_metrics)(this.font),e=this.svg_element.getAttribute("style")?.split(";");if(null!=e){const s=new Map;e.forEach((t=>{const[e,i]=t.split(":");""!=e.trim()&&s.set(e.trim(),i.trim())}));const i=(0,d.parse_css_length)(s.get("vertical-align"));"ex"==i?.unit?this.valign=i.value*t.x_height:"px"==i?.unit&&(this.valign=i.value)}const s=(()=>{const t=this.svg_element.getAttribute("width"),e=this.svg_element.getAttribute("height");return{width:null!=t&&t.endsWith("ex")?parseFloat(t):1,height:null!=e&&e.endsWith("ex")?parseFloat(e):1}})();return{width:t.x_height*s.width,height:t.x_height*s.height}}get truncated_text(){return this.model.text.length>6?`${this.model.text.substring(0,6)}...`:this.model.text}_size(){if(null==this.svg_image)return"failed"==this.provider.status||"not_started"==this.provider.status?{width:(0,u.text_width)(this.truncated_text,this.font),height:(0,d.font_metrics)(this.font).height}:{width:this._base_font_size,height:this._base_font_size};const t=(0,d.font_metrics)(this.font);let{width:e,height:s}=this.get_image_dimensions();s=Math.max(s,t.height);return{width:e*("%"==this.width?.unit?this.width.value:1),height:s*("%"==this.height?.unit?this.height.value:1)}}bbox(){const{p0:t,p1:e,p2:s,p3:i}=this.rect(),n=Math.min(t.x,e.x,s.x,i.x),h=Math.min(t.y,e.y,s.y,i.y),o=Math.max(t.x,e.x,s.x,i.x),r=Math.max(t.y,e.y,s.y,i.y);return new p.BBox({left:n,right:o,top:h,bottom:r})}rect(){const t=this._rect(),{angle:e}=this;if(null==e||0==e)return t;{const{sx:s,sy:i}=this.position,n=new x.AffineTransform;return n.translate(s,i),n.rotate(e),n.translate(-s,-i),n.apply_rect(t)}}paint_rect(t){const{p0:e,p1:s,p2:i,p3:n}=this.rect();t.save(),t.strokeStyle="red",t.lineWidth=1,t.beginPath();const{round:h}=Math;t.moveTo(h(e.x),h(e.y)),t.lineTo(h(s.x),h(s.y)),t.lineTo(h(i.x),h(i.y)),t.lineTo(h(n.x),h(n.y)),t.closePath(),t.stroke(),t.restore()}paint_bbox(t){const{x:e,y:s,width:i,height:n}=this.bbox();t.save(),t.strokeStyle="blue",t.lineWidth=1,t.beginPath();const{round:h}=Math;t.moveTo(h(e),h(s)),t.lineTo(h(e),h(s+n)),t.lineTo(h(e+i),h(s+n)),t.lineTo(h(e+i),h(s)),t.closePath(),t.stroke(),t.restore()}async request_image(){if(null==this.provider.MathJax)return;const t=this._process_text();if(null==t)return void(this._has_finished=!0);const e=t.children[0];this.svg_element=e,e.setAttribute("font",this.font),e.setAttribute("stroke",this.color);const s=e.outerHTML,i=`data:image/svg+xml;utf-8,${encodeURIComponent(s)}`;this.svg_image=await(0,l.load_image)(i)}async load_image(){await this.request_image(),this.parent.request_layout()}paint(t){null==this.svg_image&&("not_started"!=this.provider.status&&"loading"!=this.provider.status||this.provider.ready.connect((()=>this.load_image())),"loaded"==this.provider.status&&this.load_image()),t.save();const{sx:e,sy:s}=this.position,{angle:i}=this;null!=i&&0!=i&&(t.translate(e,s),t.rotate(i),t.translate(-e,-s));const{x:n,y:h}=this._computed_position();if(null!=this.svg_image){const{width:e,height:s}=this.get_image_dimensions();t.drawImage(this.svg_image,n,h,e,s)}else"failed"!=this.provider.status&&"not_started"!=this.provider.status||(t.fillStyle=this.color,t.font=this.font,t.textAlign="left",t.textBaseline="alphabetic",t.fillText(this.truncated_text,n,h+(0,d.font_metrics)(this.font).ascent));t.restore(),this._has_finished||"failed"!=this.provider.status&&null==this.svg_image||(this._has_finished=!0,this.parent.notify_finished_after_paint())}}s.MathTextView=y,y.__name__="MathTextView";class v extends f.BaseText{constructor(t){super(t)}}s.MathText=v,v.__name__="MathText";class b extends y{get styled_text(){return this.text}_process_text(){}_size(){return{width:(0,u.text_width)(this.text,this.font),height:(0,d.font_metrics)(this.font).height}}paint(t){t.save();const{sx:e,sy:s}=this.position,{angle:i}=this;null!=i&&0!=i&&(t.translate(e,s),t.rotate(i),t.translate(-e,-s));const{x:n,y:h}=this._computed_position();t.fillStyle=this.color,t.font=this.font,t.textAlign="left",t.textBaseline="alphabetic",t.fillText(this.text,n,h+(0,d.font_metrics)(this.font).ascent),t.restore(),this._has_finished=!0,this.parent.notify_finished_after_paint()}}s.AsciiView=b,b.__name__="AsciiView";class w extends v{constructor(t){super(t)}}s.Ascii=w,h=w,w.__name__="Ascii",h.prototype.default_view=b;class M extends y{get styled_text(){let t=this.text.trim(),e=t.match(/