kline-orderbook-chart 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chart_engine.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class D{__destroy_into_raw(){const _=this.__mrd_ptr;return this.__mrd_ptr=0,L.unregister(this),_}free(){const _=this.__destroy_into_raw();t.__mrd_chartengine_free(_,0)}add_anchored_vwap(_,e,r,n,s,i,a){return t.chartengine_add_anchored_vwap(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_arrow(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_arrow(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_arrow_marker_down(_,e,r,n,s,i,a){return t.chartengine_add_arrow_marker_down(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_arrow_marker_up(_,e,r,n,s,i,a){return t.chartengine_add_arrow_marker_up(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_brush_point(_,e){t.chartengine_add_brush_point(this.__mrd_ptr,_,e)}add_circle(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_circle(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_elliott_impulse(_,e,r,n,s,i,a){return t.chartengine_add_elliott_impulse(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_elliott_manual_point(_,e){return t.chartengine_add_elliott_manual_point(this.__mrd_ptr,_,e)!==0}add_fib_extension(_,e,r,n,s,i,a,c,d,g,m,u){return t.chartengine_add_fib_extension(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)>>>0}add_fib_retracement(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_fib_retracement(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_horizontal_line(_,e,r,n,s,i,a,c){return t.chartengine_add_horizontal_line(this.__mrd_ptr,_,e,r,n,s,i,a,c)>>>0}add_long_position(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_long_position(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_marker(_,e,r){t.chartengine_add_marker(this.__mrd_ptr,_,e,r)}add_parallel_channel(_,e,r,n,s,i,a,c,d,g,m,u){return t.chartengine_add_parallel_channel(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)>>>0}add_path_point(_,e){t.chartengine_add_path_point(this.__mrd_ptr,_,e)}add_price_label(_,e,r,n,s,i,a){return t.chartengine_add_price_label(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_price_range(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_price_range(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_short_position(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_short_position(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_text_note(_,e,r,n,s,i,a){return t.chartengine_add_text_note(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_trendline(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_trendline(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}append_heatmap_column(_,e,r,n){const s=p(_,t.__wbindgen_export),i=h;t.chartengine_append_heatmap_column(this.__mrd_ptr,s,i,e,r,n)}append_kline(_,e,r,n,s,i){t.chartengine_append_kline(this.__mrd_ptr,_,e,r,n,s,i)}append_real_timestamp(_){t.chartengine_append_real_timestamp(this.__mrd_ptr,_)}cancel_brush(){t.chartengine_cancel_brush(this.__mrd_ptr)}cancel_elliott_manual(){t.chartengine_cancel_elliott_manual(this.__mrd_ptr)}cancel_path(){t.chartengine_cancel_path(this.__mrd_ptr)}chart_area_h(){return t.chartengine_chart_area_h(this.__mrd_ptr)}chart_area_w(){return t.chartengine_chart_area_w(this.__mrd_ptr)}chart_area_x(){return t.chartengine_chart_area_x(this.__mrd_ptr)}chart_area_y(){return t.chartengine_chart_area_y(this.__mrd_ptr)}clear_channel_preview(){t.chartengine_clear_channel_preview(this.__mrd_ptr)}clear_drawing_preview(){t.chartengine_clear_drawing_preview(this.__mrd_ptr)}clear_drawings(){t.chartengine_clear_drawings(this.__mrd_ptr)}clear_elliott_preview(){t.chartengine_clear_elliott_preview(this.__mrd_ptr)}clear_fib_ext_preview(){t.chartengine_clear_fib_ext_preview(this.__mrd_ptr)}clear_heatmap_prefetch_range(){t.chartengine_clear_heatmap_prefetch_range(this.__mrd_ptr)}clear_hover_price(){t.chartengine_clear_hover_price(this.__mrd_ptr)}clear_large_trades(){t.chartengine_clear_large_trades(this.__mrd_ptr)}clear_live_signals(){t.chartengine_clear_live_signals(this.__mrd_ptr)}clear_markers(){t.chartengine_clear_markers(this.__mrd_ptr)}custom_band(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h,d=p(e,t.__wbindgen_export),g=h;t.chartengine_custom_band(this.__mrd_ptr,a,c,d,g,r,n,s,i)}custom_begin(){t.chartengine_custom_begin(this.__mrd_ptr)}custom_circle_px(_,e,r,n,s,i,a,c,d,g,m,u){t.chartengine_custom_circle_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)}custom_clip_rect(_,e,r,n){t.chartengine_custom_clip_rect(this.__mrd_ptr,_,e,r,n)}custom_command_count(){return t.chartengine_custom_command_count(this.__mrd_ptr)>>>0}custom_dashed_hline(_,e,r,n,s,i,a,c){t.chartengine_custom_dashed_hline(this.__mrd_ptr,_,e,r,n,s,i,a,c)}custom_end(){t.chartengine_custom_end(this.__mrd_ptr)}custom_fill_rect_px(_,e,r,n,s,i,a,c){t.chartengine_custom_fill_rect_px(this.__mrd_ptr,_,e,r,n,s,i,a,c)}custom_hline(_,e,r,n,s,i){t.chartengine_custom_hline(this.__mrd_ptr,_,e,r,n,s,i)}custom_line_px(_,e,r,n,s,i,a,c,d){t.chartengine_custom_line_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,d)}custom_marker(_,e,r,n,s,i,a){t.chartengine_custom_marker(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_marker_down(_,e,r,n,s,i,a){t.chartengine_custom_marker_down(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_marker_up(_,e,r,n,s,i,a){t.chartengine_custom_marker_up(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_price_label(_,e,r,n,s,i,a){const c=R(e,t.__wbindgen_export,t.__wbindgen_export2),d=h;t.chartengine_custom_price_label(this.__mrd_ptr,_,c,d,r,n,s,i,a)}custom_restore(){t.chartengine_custom_restore(this.__mrd_ptr)}custom_save(){t.chartengine_custom_save(this.__mrd_ptr)}custom_series_dashed_line(_,e,r,n,s,i,a,c){const d=p(_,t.__wbindgen_export),g=h;t.chartengine_custom_series_dashed_line(this.__mrd_ptr,d,g,e,r,n,s,i,a,c)}custom_series_line(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h;t.chartengine_custom_series_line(this.__mrd_ptr,a,c,e,r,n,s,i)}custom_stroke_rect_px(_,e,r,n,s,i,a,c,d){t.chartengine_custom_stroke_rect_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,d)}custom_text(_,e,r,n,s,i,a,c,d){const g=R(r,t.__wbindgen_export,t.__wbindgen_export2),m=h;t.chartengine_custom_text(this.__mrd_ptr,_,e,g,m,n,s,i,a,c,d)}custom_text_px(_,e,r,n,s,i,a,c,d){const g=R(r,t.__wbindgen_export,t.__wbindgen_export2),m=h;t.chartengine_custom_text_px(this.__mrd_ptr,_,e,g,m,n,s,i,a,c,d)}delta_histogram_enabled(){return t.chartengine_delta_histogram_enabled(this.__mrd_ptr)!==0}deselect_drawing(){t.chartengine_deselect_drawing(this.__mrd_ptr)}deselect_marker(){t.chartengine_deselect_marker(this.__mrd_ptr)}disable_cvd(){t.chartengine_disable_cvd(this.__mrd_ptr)}disable_delta_histogram(){t.chartengine_disable_delta_histogram(this.__mrd_ptr)}disable_ema_structure(){t.chartengine_disable_ema_structure(this.__mrd_ptr)}disable_forex_signals(){t.chartengine_disable_forex_signals(this.__mrd_ptr)}disable_funding_rate(){t.chartengine_disable_funding_rate(this.__mrd_ptr)}disable_large_trades(){t.chartengine_disable_large_trades(this.__mrd_ptr)}disable_liq_heatmap(){t.chartengine_disable_liq_heatmap(this.__mrd_ptr)}disable_live_signals(){t.chartengine_disable_live_signals(this.__mrd_ptr)}disable_oi(){t.chartengine_disable_oi(this.__mrd_ptr)}disable_rsi(){t.chartengine_disable_rsi(this.__mrd_ptr)}disable_smart_ranges(){t.chartengine_disable_smart_ranges(this.__mrd_ptr)}disable_stop_iceberg(){t.chartengine_disable_stop_iceberg(this.__mrd_ptr)}disable_tpo(){t.chartengine_disable_tpo(this.__mrd_ptr)}disable_volume(){t.chartengine_disable_volume(this.__mrd_ptr)}disable_vpin(){t.chartengine_disable_vpin(this.__mrd_ptr)}disable_vrvp(){t.chartengine_disable_vrvp(this.__mrd_ptr)}drawing_count(){return t.chartengine_drawing_count(this.__mrd_ptr)>>>0}enable_cvd(){t.chartengine_enable_cvd(this.__mrd_ptr)}enable_delta_histogram(){t.chartengine_enable_delta_histogram(this.__mrd_ptr)}enable_ema_structure(){t.chartengine_enable_ema_structure(this.__mrd_ptr)}enable_forex_signals(){t.chartengine_enable_forex_signals(this.__mrd_ptr)}enable_funding_rate(){t.chartengine_enable_funding_rate(this.__mrd_ptr)}enable_large_trades(){t.chartengine_enable_large_trades(this.__mrd_ptr)}enable_liq_heatmap(){t.chartengine_enable_liq_heatmap(this.__mrd_ptr)}enable_live_signals(){t.chartengine_enable_live_signals(this.__mrd_ptr)}enable_oi(){t.chartengine_enable_oi(this.__mrd_ptr)}enable_rsi(){t.chartengine_enable_rsi(this.__mrd_ptr)}enable_smart_ranges(){t.chartengine_enable_smart_ranges(this.__mrd_ptr)}enable_stop_iceberg(){t.chartengine_enable_stop_iceberg(this.__mrd_ptr)}enable_tpo(){t.chartengine_enable_tpo(this.__mrd_ptr)}enable_volume(){t.chartengine_enable_volume(this.__mrd_ptr)}enable_vpin(){t.chartengine_enable_vpin(this.__mrd_ptr)}enable_vrvp(){t.chartengine_enable_vrvp(this.__mrd_ptr)}export_drawings_json(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_export_drawings_json(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}finish_brush(){return t.chartengine_finish_brush(this.__mrd_ptr)>>>0}finish_elliott_manual(){return t.chartengine_finish_elliott_manual(this.__mrd_ptr)>>>0}finish_path(){return t.chartengine_finish_path(this.__mrd_ptr)>>>0}fit_content(){t.chartengine_fit_content(this.__mrd_ptr)}footprint_add_trade(_,e,r,n){t.chartengine_footprint_add_trade(this.__mrd_ptr,_,e,r,n)}footprint_add_trade_batch(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_footprint_add_trade_batch(this.__mrd_ptr,e,r)}footprint_clear(){t.chartengine_footprint_clear(this.__mrd_ptr)}footprint_clear_bar(_){t.chartengine_footprint_clear_bar(this.__mrd_ptr,_)}footprint_ensure_len(_){t.chartengine_footprint_ensure_len(this.__mrd_ptr,_)}footprint_get_display_mode(){return t.chartengine_footprint_get_display_mode(this.__mrd_ptr)}footprint_get_show_profile(){return t.chartengine_footprint_get_show_profile(this.__mrd_ptr)!==0}footprint_get_show_signals(){return t.chartengine_footprint_get_show_signals(this.__mrd_ptr)!==0}footprint_prepend_empty(_){t.chartengine_footprint_prepend_empty(this.__mrd_ptr,_)}footprint_profile_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_footprint_profile_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}footprint_set_bar(_,e,r,n,s){const i=p(r,t.__wbindgen_export),a=h,c=p(n,t.__wbindgen_export),d=h,g=p(s,t.__wbindgen_export),m=h;t.chartengine_footprint_set_bar(this.__mrd_ptr,_,e,i,a,c,d,g,m)}footprint_set_display_mode(_){t.chartengine_footprint_set_display_mode(this.__mrd_ptr,_)}footprint_set_show_profile(_){t.chartengine_footprint_set_show_profile(this.__mrd_ptr,_)}footprint_set_show_signals(_){t.chartengine_footprint_set_show_signals(this.__mrd_ptr,_)}footprint_signal_count(){return t.chartengine_footprint_signal_count(this.__mrd_ptr)>>>0}get_chart_type(){return t.chartengine_get_chart_type(this.__mrd_ptr)}get_command_buffer_len(){return t.chartengine_get_command_buffer_len(this.__mrd_ptr)>>>0}get_command_buffer_ptr(){return t.chartengine_get_command_buffer_ptr(this.__mrd_ptr)>>>0}get_custom_buffer_len(){return t.chartengine_get_custom_buffer_len(this.__mrd_ptr)>>>0}get_custom_buffer_ptr(){return t.chartengine_get_custom_buffer_ptr(this.__mrd_ptr)>>>0}get_cvd_mode(){return t.chartengine_get_cvd_mode(this.__mrd_ptr)}get_cvd_ratio(){return t.chartengine_get_cvd_ratio(this.__mrd_ptr)}get_cvd_show_delta(){return t.chartengine_get_cvd_show_delta(this.__mrd_ptr)!==0}get_drawing_color(_){return t.chartengine_get_drawing_color(this.__mrd_ptr,_)>>>0}get_drawing_dashed(_){return t.chartengine_get_drawing_dashed(this.__mrd_ptr,_)!==0}get_drawing_font_size(_){return t.chartengine_get_drawing_font_size(this.__mrd_ptr,_)}get_drawing_hide_label(_){return t.chartengine_get_drawing_hide_label(this.__mrd_ptr,_)!==0}get_drawing_kind_id(_){return t.chartengine_get_drawing_kind_id(this.__mrd_ptr,_)}get_drawing_text(_){let e,r;try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_drawing_text(i,this.__mrd_ptr,_);var n=l().getInt32(i+4*0,!0),s=l().getInt32(i+4*1,!0);return e=n,r=s,b(n,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,r,1)}}get_forex_signals_count(){return t.chartengine_get_forex_signals_count(this.__mrd_ptr)>>>0}get_fr_ratio(){return t.chartengine_get_fr_ratio(this.__mrd_ptr)}get_heatmap_data_max(){return t.chartengine_get_heatmap_data_max(this.__mrd_ptr)}get_heatmap_data_min(){return t.chartengine_get_heatmap_data_min(this.__mrd_ptr)}get_heatmap_last_timestamp(){return t.chartengine_get_heatmap_last_timestamp(this.__mrd_ptr)}get_heatmap_prefetch_max(){return t.chartengine_get_heatmap_prefetch_max(this.__mrd_ptr)}get_heatmap_x_step(){return t.chartengine_get_heatmap_x_step(this.__mrd_ptr)}get_iceberg_count(){return t.chartengine_get_iceberg_count(this.__mrd_ptr)>>>0}get_last_candle_json(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_last_candle_json(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}get_last_close(){return t.chartengine_get_last_close(this.__mrd_ptr)}get_liq_heatmap_cell_height(){return t.chartengine_get_liq_heatmap_cell_height(this.__mrd_ptr)}get_liq_heatmap_filled_pct(){return t.chartengine_get_liq_heatmap_filled_pct(this.__mrd_ptr)}get_liq_heatmap_max(){return t.chartengine_get_liq_heatmap_max(this.__mrd_ptr)}get_liq_heatmap_min(){return t.chartengine_get_liq_heatmap_min(this.__mrd_ptr)}get_liq_heatmap_seg_max(){return t.chartengine_get_liq_heatmap_seg_max(this.__mrd_ptr)}get_live_signals_count(){return t.chartengine_get_live_signals_count(this.__mrd_ptr)>>>0}get_live_signals_leverage(){return t.chartengine_get_live_signals_leverage(this.__mrd_ptr)}get_lt_data_max_vol(){return t.chartengine_get_lt_data_max_vol(this.__mrd_ptr)}get_lt_data_min_vol(){return t.chartengine_get_lt_data_min_vol(this.__mrd_ptr)}get_oi_ratio(){return t.chartengine_get_oi_ratio(this.__mrd_ptr)}get_rsi_ratio(){return t.chartengine_get_rsi_ratio(this.__mrd_ptr)}get_selected_drawing(){return t.chartengine_get_selected_drawing(this.__mrd_ptr)>>>0}get_selected_marker(){return t.chartengine_get_selected_marker(this.__mrd_ptr)>>>0}get_sr_signals_count(){return t.chartengine_get_sr_signals_count(this.__mrd_ptr)>>>0}get_stop_run_count(){return t.chartengine_get_stop_run_count(this.__mrd_ptr)>>>0}get_theme(){return t.chartengine_get_theme(this.__mrd_ptr)}get_tooltip_data(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_tooltip_data(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}get_tpo_period(){return t.chartengine_get_tpo_period(this.__mrd_ptr)>>>0}get_volume_color_mode(){return t.chartengine_get_volume_color_mode(this.__mrd_ptr)}get_volume_ma_period(){return t.chartengine_get_volume_ma_period(this.__mrd_ptr)>>>0}get_volume_show_ma(){return t.chartengine_get_volume_show_ma(this.__mrd_ptr)!==0}get_volume_show_signals(){return t.chartengine_get_volume_show_signals(this.__mrd_ptr)!==0}get_vpin_bucket_size(){return t.chartengine_get_vpin_bucket_size(this.__mrd_ptr)>>>0}get_vpin_num_buckets(){return t.chartengine_get_vpin_num_buckets(this.__mrd_ptr)>>>0}get_vpin_ratio(){return t.chartengine_get_vpin_ratio(this.__mrd_ptr)}get_vpin_threshold(){return t.chartengine_get_vpin_threshold(this.__mrd_ptr)}hide_crosshair(){t.chartengine_hide_crosshair(this.__mrd_ptr)}hit_test_drawing(_,e){return t.chartengine_hit_test_drawing(this.__mrd_ptr,_,e)>>>0}hit_test_drawing_anchor(_,e){return t.chartengine_hit_test_drawing_anchor(this.__mrd_ptr,_,e)}hit_test_marker(_,e){return t.chartengine_hit_test_marker(this.__mrd_ptr,_,e)>>>0}hit_zone(_,e){return t.chartengine_hit_zone(this.__mrd_ptr,_,e)}hover_hit_test(_,e){try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_hover_hit_test(i,this.__mrd_ptr,_,e);var r=l().getInt32(i+4*0,!0),n=l().getInt32(i+4*1,!0),s=H(r,n).slice();return t.__wbindgen_export3(r,n*4,4),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}import_drawings_json(_){const e=R(_,t.__wbindgen_export,t.__wbindgen_export2),r=h;t.chartengine_import_drawings_json(this.__mrd_ptr,e,r)}is_cvd_enabled(){return t.chartengine_is_cvd_enabled(this.__mrd_ptr)!==0}is_dirty(){return t.chartengine_is_dirty(this.__mrd_ptr)!==0}is_ema_structure_enabled(){return t.chartengine_is_ema_structure_enabled(this.__mrd_ptr)!==0}is_forex_signals_enabled(){return t.chartengine_is_forex_signals_enabled(this.__mrd_ptr)!==0}is_funding_rate_enabled(){return t.chartengine_is_funding_rate_enabled(this.__mrd_ptr)!==0}is_large_trades_enabled(){return t.chartengine_is_large_trades_enabled(this.__mrd_ptr)!==0}is_liq_heatmap_enabled(){return t.chartengine_is_liq_heatmap_enabled(this.__mrd_ptr)!==0}is_liq_heatmap_filled_zones(){return t.chartengine_is_liq_heatmap_filled_zones(this.__mrd_ptr)!==0}is_liq_heatmap_predictions(){return t.chartengine_is_liq_heatmap_predictions(this.__mrd_ptr)!==0}is_liq_heatmap_profile(){return t.chartengine_is_liq_heatmap_profile(this.__mrd_ptr)!==0}is_live_signals_enabled(){return t.chartengine_is_live_signals_enabled(this.__mrd_ptr)!==0}is_oi_enabled(){return t.chartengine_is_oi_enabled(this.__mrd_ptr)!==0}is_rsi_enabled(){return t.chartengine_is_rsi_enabled(this.__mrd_ptr)!==0}is_rsi_show_traps(){return t.chartengine_is_rsi_show_traps(this.__mrd_ptr)!==0}is_smart_ranges_enabled(){return t.chartengine_is_smart_ranges_enabled(this.__mrd_ptr)!==0}is_stop_iceberg_enabled(){return t.chartengine_is_stop_iceberg_enabled(this.__mrd_ptr)!==0}is_tpo_enabled(){return t.chartengine_is_tpo_enabled(this.__mrd_ptr)!==0}is_tpo_signals(){return t.chartengine_is_tpo_signals(this.__mrd_ptr)!==0}is_volume_enabled(){return t.chartengine_is_volume_enabled(this.__mrd_ptr)!==0}is_vpin_enabled(){return t.chartengine_is_vpin_enabled(this.__mrd_ptr)!==0}is_vrvp_enabled(){return t.chartengine_is_vrvp_enabled(this.__mrd_ptr)!==0}kline_closes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_closes(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_count(){return t.chartengine_kline_count(this.__mrd_ptr)>>>0}kline_highs(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_highs(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_lows(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_lows(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_opens(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_opens(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_timestamps(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_timestamps(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_volumes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_volumes(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}liq_filled_zone_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_filled_zone_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_heatmap_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_heatmap_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_predict_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_predict_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_zone_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_zone_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}lt_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_lt_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}move_drawing(_,e){t.chartengine_move_drawing(this.__mrd_ptr,_,e)}constructor(_,e){const r=t.chartengine_new(_,e);return this.__mrd_ptr=r>>>0,L.register(this,this.__mrd_ptr,this),this}oi_to_screen_y(_){return t.chartengine_oi_to_screen_y(this.__mrd_ptr,_)}pan(_,e){t.chartengine_pan(this.__mrd_ptr,_,e)}pan_x(_){t.chartengine_pan_x(this.__mrd_ptr,_)}pan_y(_){t.chartengine_pan_y(this.__mrd_ptr,_)}pop_last_kline(){return t.chartengine_pop_last_kline(this.__mrd_ptr)!==0}prepend_klines(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h,d=p(e,t.__wbindgen_export),g=h,m=p(r,t.__wbindgen_export),u=h,f=p(n,t.__wbindgen_export),x=h,k=p(s,t.__wbindgen_export),I=h,z=p(i,t.__wbindgen_export),q=h;t.chartengine_prepend_klines(this.__mrd_ptr,a,c,d,g,m,u,f,x,k,I,z,q)}push_large_trade(_,e,r,n){t.chartengine_push_large_trade(this.__mrd_ptr,_,e,r,n)}remove_drawing(_){t.chartengine_remove_drawing(this.__mrd_ptr,_)}remove_marker(_){t.chartengine_remove_marker(this.__mrd_ptr,_)}render(){return t.chartengine_render(this.__mrd_ptr)>>>0}resize(_,e){t.chartengine_resize(this.__mrd_ptr,_,e)}rsi_to_screen_y(_){return t.chartengine_rsi_to_screen_y(this.__mrd_ptr,_)}screen_to_cvd_y(_){return t.chartengine_screen_to_cvd_y(this.__mrd_ptr,_)}screen_to_fr_y(_){return t.chartengine_screen_to_fr_y(this.__mrd_ptr,_)}screen_to_oi_y(_){return t.chartengine_screen_to_oi_y(this.__mrd_ptr,_)}screen_to_rsi_y(_){return t.chartengine_screen_to_rsi_y(this.__mrd_ptr,_)}screen_to_vpin_y(_){return t.chartengine_screen_to_vpin_y(this.__mrd_ptr,_)}screen_to_world_x(_){return t.chartengine_screen_to_world_x(this.__mrd_ptr,_)}screen_to_world_y(_){return t.chartengine_screen_to_world_y(this.__mrd_ptr,_)}select_drawing(_){t.chartengine_select_drawing(this.__mrd_ptr,_)}select_marker(_){t.chartengine_select_marker(this.__mrd_ptr,_)}set_candle_interval(_){t.chartengine_set_candle_interval(this.__mrd_ptr,_)}set_channel_preview(_,e,r,n,s,i,a,c,d,g,m,u){t.chartengine_set_channel_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)}set_chart_type(_){t.chartengine_set_chart_type(this.__mrd_ptr,_)}set_crosshair(_,e){t.chartengine_set_crosshair(this.__mrd_ptr,_,e)}set_cvd_data(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_cvd_data(this.__mrd_ptr,r,n,s,i)}set_cvd_mode(_){t.chartengine_set_cvd_mode(this.__mrd_ptr,_)}set_cvd_ratio(_){t.chartengine_set_cvd_ratio(this.__mrd_ptr,_)}set_cvd_show_delta(_){t.chartengine_set_cvd_show_delta(this.__mrd_ptr,_)}set_drawing_dashed(_,e){t.chartengine_set_drawing_dashed(this.__mrd_ptr,_,e)}set_drawing_font_size(_,e){t.chartengine_set_drawing_font_size(this.__mrd_ptr,_,e)}set_drawing_hide_label(_,e){t.chartengine_set_drawing_hide_label(this.__mrd_ptr,_,e)}set_drawing_preview(_,e,r,n,s,i,a,c,d,g,m){t.chartengine_set_drawing_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m)}set_drawing_style(_,e,r,n,s){t.chartengine_set_drawing_style(this.__mrd_ptr,_,e,r,n,s)}set_drawing_text(_,e){const r=R(e,t.__wbindgen_export,t.__wbindgen_export2),n=h;t.chartengine_set_drawing_text(this.__mrd_ptr,_,r,n)}set_elliott_manual_cursor(_,e){t.chartengine_set_elliott_manual_cursor(this.__mrd_ptr,_,e)}set_elliott_preview(_,e,r,n,s,i,a){t.chartengine_set_elliott_preview(this.__mrd_ptr,_,e,r,n,s,i,a)}set_es_ema1_len(_){t.chartengine_set_es_ema1_len(this.__mrd_ptr,_)}set_es_ema2_len(_){t.chartengine_set_es_ema2_len(this.__mrd_ptr,_)}set_es_show_bos(_){t.chartengine_set_es_show_bos(this.__mrd_ptr,_)}set_es_show_ema1(_){t.chartengine_set_es_show_ema1(this.__mrd_ptr,_)}set_es_show_ema2(_){t.chartengine_set_es_show_ema2(this.__mrd_ptr,_)}set_es_show_wma(_){t.chartengine_set_es_show_wma(this.__mrd_ptr,_)}set_es_swing_len(_){t.chartengine_set_es_swing_len(this.__mrd_ptr,_)}set_es_wma_len(_){t.chartengine_set_es_wma_len(this.__mrd_ptr,_)}set_fib_ext_preview(_,e,r,n,s,i,a,c,d,g,m,u){t.chartengine_set_fib_ext_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)}set_footprint_tick_size(_){t.chartengine_set_footprint_tick_size(this.__mrd_ptr,_)}set_forex_signals_mode(_){t.chartengine_set_forex_signals_mode(this.__mrd_ptr,_)}set_forex_signals_setup(_){t.chartengine_set_forex_signals_setup(this.__mrd_ptr,_)}set_forex_signals_show_stats(_){t.chartengine_set_forex_signals_show_stats(this.__mrd_ptr,_)}set_fr_agg_data(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_fr_agg_data(this.__mrd_ptr,r,n,s,i)}set_fr_binance_data(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_fr_binance_data(this.__mrd_ptr,r,n,s,i)}set_fr_ratio(_){t.chartengine_set_fr_ratio(this.__mrd_ptr,_)}set_fr_show_agg(_){t.chartengine_set_fr_show_agg(this.__mrd_ptr,_)}set_fr_show_sma(_){t.chartengine_set_fr_show_sma(this.__mrd_ptr,_)}set_heatmap(_,e,r,n,s,i,a){const c=p(_,t.__wbindgen_export),d=h;t.chartengine_set_heatmap(this.__mrd_ptr,c,d,e,r,n,s,i,a)}set_heatmap_prefetch_range(_){t.chartengine_set_heatmap_prefetch_range(this.__mrd_ptr,_)}set_heatmap_range(_,e){t.chartengine_set_heatmap_range(this.__mrd_ptr,_,e)}set_hover_price(_){t.chartengine_set_hover_price(this.__mrd_ptr,_)}set_iceberg_events(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h,d=p(e,t.__wbindgen_export),g=h,m=p(r,t.__wbindgen_export),u=h,f=p(n,t.__wbindgen_export),x=h,k=J(s,t.__wbindgen_export),I=h,z=G(i,t.__wbindgen_export),q=h;t.chartengine_set_iceberg_events(this.__mrd_ptr,a,c,d,g,m,u,f,x,k,I,z,q)}set_klines(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h,d=p(e,t.__wbindgen_export),g=h,m=p(r,t.__wbindgen_export),u=h,f=p(n,t.__wbindgen_export),x=h,k=p(s,t.__wbindgen_export),I=h,z=p(i,t.__wbindgen_export),q=h;t.chartengine_set_klines(this.__mrd_ptr,a,c,d,g,m,u,f,x,k,I,z,q)}set_large_trades_data(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_set_large_trades_data(this.__mrd_ptr,e,r)}set_license_state(_,e,r){t.chartengine_set_license_state(this.__mrd_ptr,_,e,r)}set_liq_heatmap_cell_height(_){t.chartengine_set_liq_heatmap_cell_height(this.__mrd_ptr,_)}set_liq_heatmap_filled_pct(_){t.chartengine_set_liq_heatmap_filled_pct(this.__mrd_ptr,_)}set_liq_heatmap_filled_zones(_){t.chartengine_set_liq_heatmap_filled_zones(this.__mrd_ptr,_)}set_liq_heatmap_predictions(_){t.chartengine_set_liq_heatmap_predictions(this.__mrd_ptr,_)}set_liq_heatmap_profile(_){t.chartengine_set_liq_heatmap_profile(this.__mrd_ptr,_)}set_liq_heatmap_range(_,e){t.chartengine_set_liq_heatmap_range(this.__mrd_ptr,_,e)}set_live_signals_data(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_set_live_signals_data(this.__mrd_ptr,e,r)}set_live_signals_leverage(_){t.chartengine_set_live_signals_leverage(this.__mrd_ptr,_)}set_live_signals_loading(_){t.chartengine_set_live_signals_loading(this.__mrd_ptr,_)}set_live_signals_pip_value(_){t.chartengine_set_live_signals_pip_value(this.__mrd_ptr,_)}set_live_signals_show_entry(_){t.chartengine_set_live_signals_show_entry(this.__mrd_ptr,_)}set_live_signals_show_labels(_){t.chartengine_set_live_signals_show_labels(this.__mrd_ptr,_)}set_live_signals_show_max_profit(_){t.chartengine_set_live_signals_show_max_profit(this.__mrd_ptr,_)}set_live_signals_show_tp_sl(_){t.chartengine_set_live_signals_show_tp_sl(this.__mrd_ptr,_)}set_live_signals_show_zones(_){t.chartengine_set_live_signals_show_zones(this.__mrd_ptr,_)}set_live_signals_text_size(_){t.chartengine_set_live_signals_text_size(this.__mrd_ptr,_)}set_live_signals_trial(_){t.chartengine_set_live_signals_trial(this.__mrd_ptr,_)}set_lt_bubble_scale(_){t.chartengine_set_lt_bubble_scale(this.__mrd_ptr,_)}set_lt_volume_filter(_,e){t.chartengine_set_lt_volume_filter(this.__mrd_ptr,_,e)}set_oi_data(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_set_oi_data(this.__mrd_ptr,e,r)}set_oi_data_ts(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_oi_data_ts(this.__mrd_ptr,r,n,s,i)}set_oi_display_mode(_){t.chartengine_set_oi_display_mode(this.__mrd_ptr,_)}set_oi_ratio(_){t.chartengine_set_oi_ratio(this.__mrd_ptr,_)}set_oi_show_on_chart(_){t.chartengine_set_oi_show_on_chart(this.__mrd_ptr,_)}set_path_cursor(_,e){t.chartengine_set_path_cursor(this.__mrd_ptr,_,e)}set_price_precision(_){t.chartengine_set_price_precision(this.__mrd_ptr,_)}set_real_timestamps(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_set_real_timestamps(this.__mrd_ptr,e,r)}set_replay_hovered(_){t.chartengine_set_replay_hovered(this.__mrd_ptr,_)}set_replay_preview(_){t.chartengine_set_replay_preview(this.__mrd_ptr,_)}set_replay_state(_,e,r){t.chartengine_set_replay_state(this.__mrd_ptr,_,e,r)}set_rsi_period(_){t.chartengine_set_rsi_period(this.__mrd_ptr,_)}set_rsi_ratio(_){t.chartengine_set_rsi_ratio(this.__mrd_ptr,_)}set_rsi_show_divergence(_){t.chartengine_set_rsi_show_divergence(this.__mrd_ptr,_)}set_rsi_show_ema(_){t.chartengine_set_rsi_show_ema(this.__mrd_ptr,_)}set_rsi_show_signals(_){t.chartengine_set_rsi_show_signals(this.__mrd_ptr,_)}set_rsi_show_traps(_){t.chartengine_set_rsi_show_traps(this.__mrd_ptr,_)}set_rsi_show_wma(_){t.chartengine_set_rsi_show_wma(this.__mrd_ptr,_)}set_rsi_smoothing(_){t.chartengine_set_rsi_smoothing(this.__mrd_ptr,_)}set_si_show_icebergs(_){t.chartengine_set_si_show_icebergs(this.__mrd_ptr,_)}set_si_show_stops(_){t.chartengine_set_si_show_stops(this.__mrd_ptr,_)}set_si_show_zones(_){t.chartengine_set_si_show_zones(this.__mrd_ptr,_)}set_sr_fvg_extend(_){t.chartengine_set_sr_fvg_extend(this.__mrd_ptr,_)}set_sr_fvg_htf(_){t.chartengine_set_sr_fvg_htf(this.__mrd_ptr,_)}set_sr_fvg_mitigation(_){t.chartengine_set_sr_fvg_mitigation(this.__mrd_ptr,_)}set_sr_fvg_theme(_){t.chartengine_set_sr_fvg_theme(this.__mrd_ptr,_)}set_sr_htf_minutes(_){t.chartengine_set_sr_htf_minutes(this.__mrd_ptr,_)}set_sr_mitigation(_){t.chartengine_set_sr_mitigation(this.__mrd_ptr,_)}set_sr_ob_last(_){t.chartengine_set_sr_ob_last(this.__mrd_ptr,_)}set_sr_show_breakers(_){t.chartengine_set_sr_show_breakers(this.__mrd_ptr,_)}set_sr_show_fvg(_){t.chartengine_set_sr_show_fvg(this.__mrd_ptr,_)}set_sr_show_fvg_signals(_){t.chartengine_set_sr_show_fvg_signals(this.__mrd_ptr,_)}set_sr_show_htf_ob(_){t.chartengine_set_sr_show_htf_ob(this.__mrd_ptr,_)}set_sr_show_metrics(_){t.chartengine_set_sr_show_metrics(this.__mrd_ptr,_)}set_sr_show_ob(_){t.chartengine_set_sr_show_ob(this.__mrd_ptr,_)}set_sr_show_ob_activity(_){t.chartengine_set_sr_show_ob_activity(this.__mrd_ptr,_)}set_sr_show_ob_signals(_){t.chartengine_set_sr_show_ob_signals(this.__mrd_ptr,_)}set_sr_show_predict(_){t.chartengine_set_sr_show_predict(this.__mrd_ptr,_)}set_sr_show_smart_rev(_){t.chartengine_set_sr_show_smart_rev(this.__mrd_ptr,_)}set_sr_smart_rev_htf(_){t.chartengine_set_sr_smart_rev_htf(this.__mrd_ptr,_)}set_sr_stats_position(_){t.chartengine_set_sr_stats_position(this.__mrd_ptr,_)}set_sr_stats_type(_){t.chartengine_set_sr_stats_type(this.__mrd_ptr,_)}set_sr_text_size(_){t.chartengine_set_sr_text_size(this.__mrd_ptr,_)}set_theme(_){t.chartengine_set_theme(this.__mrd_ptr,_)}set_tpo_ib(_){t.chartengine_set_tpo_ib(this.__mrd_ptr,_)}set_tpo_ib_minutes(_){t.chartengine_set_tpo_ib_minutes(this.__mrd_ptr,_)}set_tpo_letter_minutes(_){t.chartengine_set_tpo_letter_minutes(this.__mrd_ptr,_)}set_tpo_naked_poc(_){t.chartengine_set_tpo_naked_poc(this.__mrd_ptr,_)}set_tpo_period(_){t.chartengine_set_tpo_period(this.__mrd_ptr,_)}set_tpo_poc_line(_){t.chartengine_set_tpo_poc_line(this.__mrd_ptr,_)}set_tpo_profile_shape(_){t.chartengine_set_tpo_profile_shape(this.__mrd_ptr,_)}set_tpo_signals(_){t.chartengine_set_tpo_signals(this.__mrd_ptr,_)}set_tpo_single_prints(_){t.chartengine_set_tpo_single_prints(this.__mrd_ptr,_)}set_tpo_va_lines(_){t.chartengine_set_tpo_va_lines(this.__mrd_ptr,_)}set_volume_color_mode(_){t.chartengine_set_volume_color_mode(this.__mrd_ptr,_)}set_volume_ma_period(_){t.chartengine_set_volume_ma_period(this.__mrd_ptr,_)}set_volume_show_ma(_){t.chartengine_set_volume_show_ma(this.__mrd_ptr,_)}set_volume_show_signals(_){t.chartengine_set_volume_show_signals(this.__mrd_ptr,_)}set_vpin_bucket_size(_){t.chartengine_set_vpin_bucket_size(this.__mrd_ptr,_)}set_vpin_data(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_vpin_data(this.__mrd_ptr,r,n,s,i)}set_vpin_num_buckets(_){t.chartengine_set_vpin_num_buckets(this.__mrd_ptr,_)}set_vpin_ratio(_){t.chartengine_set_vpin_ratio(this.__mrd_ptr,_)}set_vpin_show_sma(_){t.chartengine_set_vpin_show_sma(this.__mrd_ptr,_)}set_vpin_show_zones(_){t.chartengine_set_vpin_show_zones(this.__mrd_ptr,_)}set_vpin_threshold(_){t.chartengine_set_vpin_threshold(this.__mrd_ptr,_)}set_vrvp_poc_line(_){t.chartengine_set_vrvp_poc_line(this.__mrd_ptr,_)}show_latest(_){t.chartengine_show_latest(this.__mrd_ptr,_)}start_brush(_,e,r,n,s){t.chartengine_start_brush(this.__mrd_ptr,_,e,r,n,s)}start_elliott_manual(_,e,r,n,s){t.chartengine_start_elliott_manual(this.__mrd_ptr,_,e,r,n,s)}start_path(_,e,r,n,s,i){t.chartengine_start_path(this.__mrd_ptr,_,e,r,n,s,i)}update_drawing_anchor(_,e,r){t.chartengine_update_drawing_anchor(this.__mrd_ptr,_,e,r)}update_heatmap_column(_,e){const r=p(e,t.__wbindgen_export),n=h;t.chartengine_update_heatmap_column(this.__mrd_ptr,_,r,n)}update_heatmap_column_at(_,e,r,n){const s=p(_,t.__wbindgen_export),i=h;t.chartengine_update_heatmap_column_at(this.__mrd_ptr,s,i,e,r,n)}update_last_heatmap_column(_,e,r){const n=p(_,t.__wbindgen_export),s=h;t.chartengine_update_last_heatmap_column(this.__mrd_ptr,n,s,e,r)}update_last_kline(_,e,r,n,s,i){t.chartengine_update_last_kline(this.__mrd_ptr,_,e,r,n,s,i)}vpin_to_screen_y(_){return t.chartengine_vpin_to_screen_y(this.__mrd_ptr,_)}vrvp_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_vrvp_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}world_to_screen_x(_){return t.chartengine_world_to_screen_x(this.__mrd_ptr,_)}world_to_screen_y(_){return t.chartengine_world_to_screen_y(this.__mrd_ptr,_)}zoom(_,e,r){t.chartengine_zoom(this.__mrd_ptr,_,e,r)}zoom_x(_,e){t.chartengine_zoom_x(this.__mrd_ptr,_,e)}zoom_y(_,e){t.chartengine_zoom_y(this.__mrd_ptr,_,e)}}Symbol.dispose&&(D.prototype[Symbol.dispose]=D.prototype.free);function r_(){const o=t.wasm_memory();return K(o)}function U(){return{__proto__:null,"./chart_engine_bg.js":{__proto__:null,__mrd___wbindgen_memory_edb3f01e3930bbf6:function(){const _=t.memory;return V(_)},__mrd___wbindgen_throw_6ddd609b62940d55:function(_,e){throw new Error(b(_,e))}}}}const L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__mrd_chartengine_free(o>>>0,1));function V(o){F===w.length&&w.push(w.length+1);const _=F;return F=w[_],w[_]=o,_}function P(o){o<1028||(w[o]=F,F=o)}function y(o,_){return o=o>>>0,C().subarray(o/8,o/8+_)}function H(o,_){return o=o>>>0,N().subarray(o/4,o/4+_)}let v=null;function l(){return(v===null||v.buffer.detached===!0||v.buffer.detached===void 0&&v.buffer!==t.memory.buffer)&&(v=new DataView(t.memory.buffer)),v}let A=null;function C(){return(A===null||A.byteLength===0)&&(A=new Float64Array(t.memory.buffer)),A}let M=null;function N(){return(M===null||M.byteLength===0)&&(M=new Int32Array(t.memory.buffer)),M}function b(o,_){return o=o>>>0,Z(o,_)}let W=null;function X(){return(W===null||W.byteLength===0)&&(W=new Uint32Array(t.memory.buffer)),W}let j=null;function O(){return(j===null||j.byteLength===0)&&(j=new Uint8Array(t.memory.buffer)),j}function Y(o){return w[o]}let w=new Array(1024).fill(void 0);w.push(void 0,null,!0,!1);let F=w.length;function G(o,_){const e=_(o.length*4,4)>>>0;return X().set(o,e/4),h=o.length,e}function J(o,_){const e=_(o.length*1,1)>>>0;return O().set(o,e/1),h=o.length,e}function p(o,_){const e=_(o.length*8,8)>>>0;return C().set(o,e/8),h=o.length,e}function R(o,_,e){if(e===void 0){const a=T.encode(o),c=_(a.length,1)>>>0;return O().subarray(c,c+a.length).set(a),h=a.length,c}let r=o.length,n=_(r,1)>>>0;const s=O();let i=0;for(;i<r;i++){const a=o.charCodeAt(i);if(a>127)break;s[n+i]=a}if(i!==r){i!==0&&(o=o.slice(i)),n=e(n,r,r=i+o.length*3,1)>>>0;const a=O().subarray(n+i,n+r),c=T.encodeInto(o,a);i+=c.written,n=e(n,r,i,1)>>>0}return h=i,n}function K(o){const _=Y(o);return P(o),_}let S=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});S.decode();const Q=2146435072;let E=0;function Z(o,_){return E+=_,E>=Q&&(S=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),S.decode(),E=_),S.decode(O().subarray(o,o+_))}const T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(o,_){const e=T.encode(o);return _.set(e),{read:o.length,written:e.length}});let h=0,$,t;function B(o,_){return t=o.exports,$=_,v=null,A=null,M=null,W=null,j=null,t}async function __(o,_){if(typeof Response=="function"&&o instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(o,_)}catch(n){if(o.ok&&e(o.type)&&o.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const r=await o.arrayBuffer();return await WebAssembly.instantiate(r,_)}else{const r=await WebAssembly.instantiate(o,_);return r instanceof WebAssembly.Instance?{instance:r,module:o}:r}function e(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function t_(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module:o}=o:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const _=U();o instanceof WebAssembly.Module||(o=new WebAssembly.Module(o));const e=new WebAssembly.Instance(o,_);return B(e,o)}async function e_(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module_or_path:o}=o:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),o===void 0&&(o=new URL("chart_engine_bg.wasm",import.meta.url));const _=U();(typeof o=="string"||typeof Request=="function"&&o instanceof Request||typeof URL=="function"&&o instanceof URL)&&(o=fetch(o));const{instance:e,module:r}=await __(await o,_);return B(e,r)}export{D as ChartEngine,e_ as default,t_ as initSync,r_ as wasm_memory};
|
|
1
|
+
class D{__destroy_into_raw(){const _=this.__mrd_ptr;return this.__mrd_ptr=0,L.unregister(this),_}free(){const _=this.__destroy_into_raw();t.__mrd_chartengine_free(_,0)}add_anchored_vwap(_,e,r,n,s,i,a){return t.chartengine_add_anchored_vwap(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_arrow(_,e,r,n,s,i,a,c,h,g){return t.chartengine_add_arrow(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g)>>>0}add_arrow_marker_down(_,e,r,n,s,i,a){return t.chartengine_add_arrow_marker_down(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_arrow_marker_up(_,e,r,n,s,i,a){return t.chartengine_add_arrow_marker_up(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_brush_point(_,e){t.chartengine_add_brush_point(this.__mrd_ptr,_,e)}add_circle(_,e,r,n,s,i,a,c,h,g){return t.chartengine_add_circle(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g)>>>0}add_elliott_impulse(_,e,r,n,s,i,a){return t.chartengine_add_elliott_impulse(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_elliott_manual_point(_,e){return t.chartengine_add_elliott_manual_point(this.__mrd_ptr,_,e)!==0}add_fib_extension(_,e,r,n,s,i,a,c,h,g,m,u){return t.chartengine_add_fib_extension(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g,m,u)>>>0}add_fib_retracement(_,e,r,n,s,i,a,c,h,g){return t.chartengine_add_fib_retracement(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g)>>>0}add_horizontal_line(_,e,r,n,s,i,a,c){return t.chartengine_add_horizontal_line(this.__mrd_ptr,_,e,r,n,s,i,a,c)>>>0}add_long_position(_,e,r,n,s,i,a,c,h,g){return t.chartengine_add_long_position(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g)>>>0}add_marker(_,e,r){t.chartengine_add_marker(this.__mrd_ptr,_,e,r)}add_parallel_channel(_,e,r,n,s,i,a,c,h,g,m,u){return t.chartengine_add_parallel_channel(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g,m,u)>>>0}add_path_point(_,e){t.chartengine_add_path_point(this.__mrd_ptr,_,e)}add_price_label(_,e,r,n,s,i,a){return t.chartengine_add_price_label(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_price_range(_,e,r,n,s,i,a,c,h,g){return t.chartengine_add_price_range(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g)>>>0}add_short_position(_,e,r,n,s,i,a,c,h,g){return t.chartengine_add_short_position(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g)>>>0}add_text_note(_,e,r,n,s,i,a){return t.chartengine_add_text_note(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_trendline(_,e,r,n,s,i,a,c,h,g){return t.chartengine_add_trendline(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g)>>>0}append_heatmap_column(_,e,r,n){const s=p(_,t.__wbindgen_export),i=d;t.chartengine_append_heatmap_column(this.__mrd_ptr,s,i,e,r,n)}append_kline(_,e,r,n,s,i){t.chartengine_append_kline(this.__mrd_ptr,_,e,r,n,s,i)}append_real_timestamp(_){t.chartengine_append_real_timestamp(this.__mrd_ptr,_)}cancel_brush(){t.chartengine_cancel_brush(this.__mrd_ptr)}cancel_elliott_manual(){t.chartengine_cancel_elliott_manual(this.__mrd_ptr)}cancel_path(){t.chartengine_cancel_path(this.__mrd_ptr)}chart_area_h(){return t.chartengine_chart_area_h(this.__mrd_ptr)}chart_area_w(){return t.chartengine_chart_area_w(this.__mrd_ptr)}chart_area_x(){return t.chartengine_chart_area_x(this.__mrd_ptr)}chart_area_y(){return t.chartengine_chart_area_y(this.__mrd_ptr)}clear_channel_preview(){t.chartengine_clear_channel_preview(this.__mrd_ptr)}clear_drawing_preview(){t.chartengine_clear_drawing_preview(this.__mrd_ptr)}clear_drawings(){t.chartengine_clear_drawings(this.__mrd_ptr)}clear_elliott_preview(){t.chartengine_clear_elliott_preview(this.__mrd_ptr)}clear_fib_ext_preview(){t.chartengine_clear_fib_ext_preview(this.__mrd_ptr)}clear_heatmap_prefetch_range(){t.chartengine_clear_heatmap_prefetch_range(this.__mrd_ptr)}clear_hover_price(){t.chartengine_clear_hover_price(this.__mrd_ptr)}clear_large_trades(){t.chartengine_clear_large_trades(this.__mrd_ptr)}clear_live_signals(){t.chartengine_clear_live_signals(this.__mrd_ptr)}clear_markers(){t.chartengine_clear_markers(this.__mrd_ptr)}custom_band(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=d,h=p(e,t.__wbindgen_export),g=d;t.chartengine_custom_band(this.__mrd_ptr,a,c,h,g,r,n,s,i)}custom_begin(){t.chartengine_custom_begin(this.__mrd_ptr)}custom_circle_px(_,e,r,n,s,i,a,c,h,g,m,u){t.chartengine_custom_circle_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g,m,u)}custom_clip_rect(_,e,r,n){t.chartengine_custom_clip_rect(this.__mrd_ptr,_,e,r,n)}custom_command_count(){return t.chartengine_custom_command_count(this.__mrd_ptr)>>>0}custom_dashed_hline(_,e,r,n,s,i,a,c){t.chartengine_custom_dashed_hline(this.__mrd_ptr,_,e,r,n,s,i,a,c)}custom_end(){t.chartengine_custom_end(this.__mrd_ptr)}custom_fill_rect_px(_,e,r,n,s,i,a,c){t.chartengine_custom_fill_rect_px(this.__mrd_ptr,_,e,r,n,s,i,a,c)}custom_hline(_,e,r,n,s,i){t.chartengine_custom_hline(this.__mrd_ptr,_,e,r,n,s,i)}custom_line_px(_,e,r,n,s,i,a,c,h){t.chartengine_custom_line_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,h)}custom_marker(_,e,r,n,s,i,a){t.chartengine_custom_marker(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_marker_down(_,e,r,n,s,i,a){t.chartengine_custom_marker_down(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_marker_up(_,e,r,n,s,i,a){t.chartengine_custom_marker_up(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_price_label(_,e,r,n,s,i,a){const c=R(e,t.__wbindgen_export,t.__wbindgen_export2),h=d;t.chartengine_custom_price_label(this.__mrd_ptr,_,c,h,r,n,s,i,a)}custom_restore(){t.chartengine_custom_restore(this.__mrd_ptr)}custom_save(){t.chartengine_custom_save(this.__mrd_ptr)}custom_series_dashed_line(_,e,r,n,s,i,a,c){const h=p(_,t.__wbindgen_export),g=d;t.chartengine_custom_series_dashed_line(this.__mrd_ptr,h,g,e,r,n,s,i,a,c)}custom_series_line(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=d;t.chartengine_custom_series_line(this.__mrd_ptr,a,c,e,r,n,s,i)}custom_stroke_rect_px(_,e,r,n,s,i,a,c,h){t.chartengine_custom_stroke_rect_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,h)}custom_text(_,e,r,n,s,i,a,c,h){const g=R(r,t.__wbindgen_export,t.__wbindgen_export2),m=d;t.chartengine_custom_text(this.__mrd_ptr,_,e,g,m,n,s,i,a,c,h)}custom_text_px(_,e,r,n,s,i,a,c,h){const g=R(r,t.__wbindgen_export,t.__wbindgen_export2),m=d;t.chartengine_custom_text_px(this.__mrd_ptr,_,e,g,m,n,s,i,a,c,h)}delta_histogram_enabled(){return t.chartengine_delta_histogram_enabled(this.__mrd_ptr)!==0}deselect_drawing(){t.chartengine_deselect_drawing(this.__mrd_ptr)}deselect_marker(){t.chartengine_deselect_marker(this.__mrd_ptr)}disable_cvd(){t.chartengine_disable_cvd(this.__mrd_ptr)}disable_delta_histogram(){t.chartengine_disable_delta_histogram(this.__mrd_ptr)}disable_ema_structure(){t.chartengine_disable_ema_structure(this.__mrd_ptr)}disable_forex_signals(){t.chartengine_disable_forex_signals(this.__mrd_ptr)}disable_funding_rate(){t.chartengine_disable_funding_rate(this.__mrd_ptr)}disable_large_trades(){t.chartengine_disable_large_trades(this.__mrd_ptr)}disable_liq_heatmap(){t.chartengine_disable_liq_heatmap(this.__mrd_ptr)}disable_live_signals(){t.chartengine_disable_live_signals(this.__mrd_ptr)}disable_oi(){t.chartengine_disable_oi(this.__mrd_ptr)}disable_rsi(){t.chartengine_disable_rsi(this.__mrd_ptr)}disable_smart_ranges(){t.chartengine_disable_smart_ranges(this.__mrd_ptr)}disable_stop_iceberg(){t.chartengine_disable_stop_iceberg(this.__mrd_ptr)}disable_tpo(){t.chartengine_disable_tpo(this.__mrd_ptr)}disable_volume(){t.chartengine_disable_volume(this.__mrd_ptr)}disable_vpin(){t.chartengine_disable_vpin(this.__mrd_ptr)}disable_vrvp(){t.chartengine_disable_vrvp(this.__mrd_ptr)}drawing_count(){return t.chartengine_drawing_count(this.__mrd_ptr)>>>0}enable_cvd(){t.chartengine_enable_cvd(this.__mrd_ptr)}enable_delta_histogram(){t.chartengine_enable_delta_histogram(this.__mrd_ptr)}enable_ema_structure(){t.chartengine_enable_ema_structure(this.__mrd_ptr)}enable_forex_signals(){t.chartengine_enable_forex_signals(this.__mrd_ptr)}enable_funding_rate(){t.chartengine_enable_funding_rate(this.__mrd_ptr)}enable_large_trades(){t.chartengine_enable_large_trades(this.__mrd_ptr)}enable_liq_heatmap(){t.chartengine_enable_liq_heatmap(this.__mrd_ptr)}enable_live_signals(){t.chartengine_enable_live_signals(this.__mrd_ptr)}enable_oi(){t.chartengine_enable_oi(this.__mrd_ptr)}enable_rsi(){t.chartengine_enable_rsi(this.__mrd_ptr)}enable_smart_ranges(){t.chartengine_enable_smart_ranges(this.__mrd_ptr)}enable_stop_iceberg(){t.chartengine_enable_stop_iceberg(this.__mrd_ptr)}enable_tpo(){t.chartengine_enable_tpo(this.__mrd_ptr)}enable_volume(){t.chartengine_enable_volume(this.__mrd_ptr)}enable_vpin(){t.chartengine_enable_vpin(this.__mrd_ptr)}enable_vrvp(){t.chartengine_enable_vrvp(this.__mrd_ptr)}export_drawings_json(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_export_drawings_json(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}finish_brush(){return t.chartengine_finish_brush(this.__mrd_ptr)>>>0}finish_elliott_manual(){return t.chartengine_finish_elliott_manual(this.__mrd_ptr)>>>0}finish_path(){return t.chartengine_finish_path(this.__mrd_ptr)>>>0}fit_content(){t.chartengine_fit_content(this.__mrd_ptr)}footprint_add_trade(_,e,r,n){t.chartengine_footprint_add_trade(this.__mrd_ptr,_,e,r,n)}footprint_add_trade_batch(_){const e=p(_,t.__wbindgen_export),r=d;t.chartengine_footprint_add_trade_batch(this.__mrd_ptr,e,r)}footprint_clear(){t.chartengine_footprint_clear(this.__mrd_ptr)}footprint_clear_bar(_){t.chartengine_footprint_clear_bar(this.__mrd_ptr,_)}footprint_ensure_len(_){t.chartengine_footprint_ensure_len(this.__mrd_ptr,_)}footprint_get_display_mode(){return t.chartengine_footprint_get_display_mode(this.__mrd_ptr)}footprint_get_show_profile(){return t.chartengine_footprint_get_show_profile(this.__mrd_ptr)!==0}footprint_get_show_signals(){return t.chartengine_footprint_get_show_signals(this.__mrd_ptr)!==0}footprint_prepend_empty(_){t.chartengine_footprint_prepend_empty(this.__mrd_ptr,_)}footprint_profile_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_footprint_profile_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}footprint_set_bar(_,e,r,n,s){const i=p(r,t.__wbindgen_export),a=d,c=p(n,t.__wbindgen_export),h=d,g=p(s,t.__wbindgen_export),m=d;t.chartengine_footprint_set_bar(this.__mrd_ptr,_,e,i,a,c,h,g,m)}footprint_set_display_mode(_){t.chartengine_footprint_set_display_mode(this.__mrd_ptr,_)}footprint_set_show_profile(_){t.chartengine_footprint_set_show_profile(this.__mrd_ptr,_)}footprint_set_show_signals(_){t.chartengine_footprint_set_show_signals(this.__mrd_ptr,_)}footprint_signal_count(){return t.chartengine_footprint_signal_count(this.__mrd_ptr)>>>0}get_chart_type(){return t.chartengine_get_chart_type(this.__mrd_ptr)}get_command_buffer_len(){return t.chartengine_get_command_buffer_len(this.__mrd_ptr)>>>0}get_command_buffer_ptr(){return t.chartengine_get_command_buffer_ptr(this.__mrd_ptr)>>>0}get_custom_buffer_len(){return t.chartengine_get_custom_buffer_len(this.__mrd_ptr)>>>0}get_custom_buffer_ptr(){return t.chartengine_get_custom_buffer_ptr(this.__mrd_ptr)>>>0}get_cvd_mode(){return t.chartengine_get_cvd_mode(this.__mrd_ptr)}get_cvd_ratio(){return t.chartengine_get_cvd_ratio(this.__mrd_ptr)}get_cvd_show_delta(){return t.chartengine_get_cvd_show_delta(this.__mrd_ptr)!==0}get_cvd_show_divergence(){return t.chartengine_get_cvd_show_divergence(this.__mrd_ptr)!==0}get_cvd_show_signals(){return t.chartengine_get_cvd_show_signals(this.__mrd_ptr)!==0}get_cvd_source(){return t.chartengine_get_cvd_source(this.__mrd_ptr)}get_drawing_color(_){return t.chartengine_get_drawing_color(this.__mrd_ptr,_)>>>0}get_drawing_dashed(_){return t.chartengine_get_drawing_dashed(this.__mrd_ptr,_)!==0}get_drawing_font_size(_){return t.chartengine_get_drawing_font_size(this.__mrd_ptr,_)}get_drawing_hide_label(_){return t.chartengine_get_drawing_hide_label(this.__mrd_ptr,_)!==0}get_drawing_kind_id(_){return t.chartengine_get_drawing_kind_id(this.__mrd_ptr,_)}get_drawing_text(_){let e,r;try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_drawing_text(i,this.__mrd_ptr,_);var n=l().getInt32(i+4*0,!0),s=l().getInt32(i+4*1,!0);return e=n,r=s,b(n,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,r,1)}}get_forex_signals_count(){return t.chartengine_get_forex_signals_count(this.__mrd_ptr)>>>0}get_fr_ratio(){return t.chartengine_get_fr_ratio(this.__mrd_ptr)}get_heatmap_data_max(){return t.chartengine_get_heatmap_data_max(this.__mrd_ptr)}get_heatmap_data_min(){return t.chartengine_get_heatmap_data_min(this.__mrd_ptr)}get_heatmap_last_timestamp(){return t.chartengine_get_heatmap_last_timestamp(this.__mrd_ptr)}get_heatmap_prefetch_max(){return t.chartengine_get_heatmap_prefetch_max(this.__mrd_ptr)}get_heatmap_x_step(){return t.chartengine_get_heatmap_x_step(this.__mrd_ptr)}get_iceberg_count(){return t.chartengine_get_iceberg_count(this.__mrd_ptr)>>>0}get_last_candle_json(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_last_candle_json(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}get_last_close(){return t.chartengine_get_last_close(this.__mrd_ptr)}get_liq_heatmap_cell_height(){return t.chartengine_get_liq_heatmap_cell_height(this.__mrd_ptr)}get_liq_heatmap_filled_pct(){return t.chartengine_get_liq_heatmap_filled_pct(this.__mrd_ptr)}get_liq_heatmap_max(){return t.chartengine_get_liq_heatmap_max(this.__mrd_ptr)}get_liq_heatmap_min(){return t.chartengine_get_liq_heatmap_min(this.__mrd_ptr)}get_liq_heatmap_seg_max(){return t.chartengine_get_liq_heatmap_seg_max(this.__mrd_ptr)}get_live_signals_count(){return t.chartengine_get_live_signals_count(this.__mrd_ptr)>>>0}get_live_signals_leverage(){return t.chartengine_get_live_signals_leverage(this.__mrd_ptr)}get_lt_data_max_vol(){return t.chartengine_get_lt_data_max_vol(this.__mrd_ptr)}get_lt_data_min_vol(){return t.chartengine_get_lt_data_min_vol(this.__mrd_ptr)}get_oi_ratio(){return t.chartengine_get_oi_ratio(this.__mrd_ptr)}get_rsi_ratio(){return t.chartengine_get_rsi_ratio(this.__mrd_ptr)}get_selected_drawing(){return t.chartengine_get_selected_drawing(this.__mrd_ptr)>>>0}get_selected_marker(){return t.chartengine_get_selected_marker(this.__mrd_ptr)>>>0}get_sr_signals_count(){return t.chartengine_get_sr_signals_count(this.__mrd_ptr)>>>0}get_stop_run_count(){return t.chartengine_get_stop_run_count(this.__mrd_ptr)>>>0}get_theme(){return t.chartengine_get_theme(this.__mrd_ptr)}get_tooltip_data(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_tooltip_data(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}get_tpo_period(){return t.chartengine_get_tpo_period(this.__mrd_ptr)>>>0}get_volume_color_mode(){return t.chartengine_get_volume_color_mode(this.__mrd_ptr)}get_volume_ma_period(){return t.chartengine_get_volume_ma_period(this.__mrd_ptr)>>>0}get_volume_show_ma(){return t.chartengine_get_volume_show_ma(this.__mrd_ptr)!==0}get_volume_show_signals(){return t.chartengine_get_volume_show_signals(this.__mrd_ptr)!==0}get_vpin_bucket_size(){return t.chartengine_get_vpin_bucket_size(this.__mrd_ptr)>>>0}get_vpin_num_buckets(){return t.chartengine_get_vpin_num_buckets(this.__mrd_ptr)>>>0}get_vpin_ratio(){return t.chartengine_get_vpin_ratio(this.__mrd_ptr)}get_vpin_threshold(){return t.chartengine_get_vpin_threshold(this.__mrd_ptr)}hide_crosshair(){t.chartengine_hide_crosshair(this.__mrd_ptr)}hit_test_drawing(_,e){return t.chartengine_hit_test_drawing(this.__mrd_ptr,_,e)>>>0}hit_test_drawing_anchor(_,e){return t.chartengine_hit_test_drawing_anchor(this.__mrd_ptr,_,e)}hit_test_marker(_,e){return t.chartengine_hit_test_marker(this.__mrd_ptr,_,e)>>>0}hit_zone(_,e){return t.chartengine_hit_zone(this.__mrd_ptr,_,e)}hover_hit_test(_,e){try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_hover_hit_test(i,this.__mrd_ptr,_,e);var r=l().getInt32(i+4*0,!0),n=l().getInt32(i+4*1,!0),s=H(r,n).slice();return t.__wbindgen_export3(r,n*4,4),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}import_drawings_json(_){const e=R(_,t.__wbindgen_export,t.__wbindgen_export2),r=d;t.chartengine_import_drawings_json(this.__mrd_ptr,e,r)}is_cvd_enabled(){return t.chartengine_is_cvd_enabled(this.__mrd_ptr)!==0}is_dirty(){return t.chartengine_is_dirty(this.__mrd_ptr)!==0}is_ema_structure_enabled(){return t.chartengine_is_ema_structure_enabled(this.__mrd_ptr)!==0}is_forex_signals_enabled(){return t.chartengine_is_forex_signals_enabled(this.__mrd_ptr)!==0}is_funding_rate_enabled(){return t.chartengine_is_funding_rate_enabled(this.__mrd_ptr)!==0}is_large_trades_enabled(){return t.chartengine_is_large_trades_enabled(this.__mrd_ptr)!==0}is_liq_heatmap_enabled(){return t.chartengine_is_liq_heatmap_enabled(this.__mrd_ptr)!==0}is_liq_heatmap_filled_zones(){return t.chartengine_is_liq_heatmap_filled_zones(this.__mrd_ptr)!==0}is_liq_heatmap_predictions(){return t.chartengine_is_liq_heatmap_predictions(this.__mrd_ptr)!==0}is_liq_heatmap_profile(){return t.chartengine_is_liq_heatmap_profile(this.__mrd_ptr)!==0}is_live_signals_enabled(){return t.chartengine_is_live_signals_enabled(this.__mrd_ptr)!==0}is_oi_enabled(){return t.chartengine_is_oi_enabled(this.__mrd_ptr)!==0}is_rsi_enabled(){return t.chartengine_is_rsi_enabled(this.__mrd_ptr)!==0}is_rsi_show_traps(){return t.chartengine_is_rsi_show_traps(this.__mrd_ptr)!==0}is_smart_ranges_enabled(){return t.chartengine_is_smart_ranges_enabled(this.__mrd_ptr)!==0}is_stop_iceberg_enabled(){return t.chartengine_is_stop_iceberg_enabled(this.__mrd_ptr)!==0}is_tpo_enabled(){return t.chartengine_is_tpo_enabled(this.__mrd_ptr)!==0}is_tpo_signals(){return t.chartengine_is_tpo_signals(this.__mrd_ptr)!==0}is_volume_enabled(){return t.chartengine_is_volume_enabled(this.__mrd_ptr)!==0}is_vpin_enabled(){return t.chartengine_is_vpin_enabled(this.__mrd_ptr)!==0}is_vrvp_enabled(){return t.chartengine_is_vrvp_enabled(this.__mrd_ptr)!==0}kline_closes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_closes(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_count(){return t.chartengine_kline_count(this.__mrd_ptr)>>>0}kline_highs(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_highs(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_lows(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_lows(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_opens(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_opens(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_timestamps(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_timestamps(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_volumes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_volumes(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}liq_filled_zone_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_filled_zone_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_heatmap_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_heatmap_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_predict_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_predict_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_zone_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_zone_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}lt_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_lt_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}move_drawing(_,e){t.chartengine_move_drawing(this.__mrd_ptr,_,e)}constructor(_,e){const r=t.chartengine_new(_,e);return this.__mrd_ptr=r>>>0,L.register(this,this.__mrd_ptr,this),this}oi_to_screen_y(_){return t.chartengine_oi_to_screen_y(this.__mrd_ptr,_)}pan(_,e){t.chartengine_pan(this.__mrd_ptr,_,e)}pan_indicator_y(_,e){t.chartengine_pan_indicator_y(this.__mrd_ptr,_,e)}pan_x(_){t.chartengine_pan_x(this.__mrd_ptr,_)}pan_y(_){t.chartengine_pan_y(this.__mrd_ptr,_)}pop_last_kline(){return t.chartengine_pop_last_kline(this.__mrd_ptr)!==0}prepend_klines(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=d,h=p(e,t.__wbindgen_export),g=d,m=p(r,t.__wbindgen_export),u=d,f=p(n,t.__wbindgen_export),x=d,k=p(s,t.__wbindgen_export),z=d,I=p(i,t.__wbindgen_export),q=d;t.chartengine_prepend_klines(this.__mrd_ptr,a,c,h,g,m,u,f,x,k,z,I,q)}push_large_trade(_,e,r,n){t.chartengine_push_large_trade(this.__mrd_ptr,_,e,r,n)}remove_drawing(_){t.chartengine_remove_drawing(this.__mrd_ptr,_)}remove_marker(_){t.chartengine_remove_marker(this.__mrd_ptr,_)}render(){return t.chartengine_render(this.__mrd_ptr)>>>0}reset_indicator_y_auto(_){t.chartengine_reset_indicator_y_auto(this.__mrd_ptr,_)}resize(_,e){t.chartengine_resize(this.__mrd_ptr,_,e)}rsi_to_screen_y(_){return t.chartengine_rsi_to_screen_y(this.__mrd_ptr,_)}screen_to_cvd_y(_){return t.chartengine_screen_to_cvd_y(this.__mrd_ptr,_)}screen_to_fr_y(_){return t.chartengine_screen_to_fr_y(this.__mrd_ptr,_)}screen_to_oi_y(_){return t.chartengine_screen_to_oi_y(this.__mrd_ptr,_)}screen_to_rsi_y(_){return t.chartengine_screen_to_rsi_y(this.__mrd_ptr,_)}screen_to_vpin_y(_){return t.chartengine_screen_to_vpin_y(this.__mrd_ptr,_)}screen_to_world_x(_){return t.chartengine_screen_to_world_x(this.__mrd_ptr,_)}screen_to_world_y(_){return t.chartengine_screen_to_world_y(this.__mrd_ptr,_)}select_drawing(_){t.chartengine_select_drawing(this.__mrd_ptr,_)}select_marker(_){t.chartengine_select_marker(this.__mrd_ptr,_)}set_candle_interval(_){t.chartengine_set_candle_interval(this.__mrd_ptr,_)}set_channel_preview(_,e,r,n,s,i,a,c,h,g,m,u){t.chartengine_set_channel_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g,m,u)}set_chart_type(_){t.chartengine_set_chart_type(this.__mrd_ptr,_)}set_crosshair(_,e){t.chartengine_set_crosshair(this.__mrd_ptr,_,e)}set_cvd_data(_,e){const r=p(_,t.__wbindgen_export),n=d,s=p(e,t.__wbindgen_export),i=d;t.chartengine_set_cvd_data(this.__mrd_ptr,r,n,s,i)}set_cvd_mode(_){t.chartengine_set_cvd_mode(this.__mrd_ptr,_)}set_cvd_ratio(_){t.chartengine_set_cvd_ratio(this.__mrd_ptr,_)}set_cvd_show_delta(_){t.chartengine_set_cvd_show_delta(this.__mrd_ptr,_)}set_cvd_show_divergence(_){t.chartengine_set_cvd_show_divergence(this.__mrd_ptr,_)}set_cvd_show_signals(_){t.chartengine_set_cvd_show_signals(this.__mrd_ptr,_)}set_cvd_source(_){t.chartengine_set_cvd_source(this.__mrd_ptr,_)}set_cvd_spot_data(_,e){const r=p(_,t.__wbindgen_export),n=d,s=p(e,t.__wbindgen_export),i=d;t.chartengine_set_cvd_spot_data(this.__mrd_ptr,r,n,s,i)}set_drawing_dashed(_,e){t.chartengine_set_drawing_dashed(this.__mrd_ptr,_,e)}set_drawing_font_size(_,e){t.chartengine_set_drawing_font_size(this.__mrd_ptr,_,e)}set_drawing_hide_label(_,e){t.chartengine_set_drawing_hide_label(this.__mrd_ptr,_,e)}set_drawing_preview(_,e,r,n,s,i,a,c,h,g,m){t.chartengine_set_drawing_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g,m)}set_drawing_style(_,e,r,n,s){t.chartengine_set_drawing_style(this.__mrd_ptr,_,e,r,n,s)}set_drawing_text(_,e){const r=R(e,t.__wbindgen_export,t.__wbindgen_export2),n=d;t.chartengine_set_drawing_text(this.__mrd_ptr,_,r,n)}set_elliott_manual_cursor(_,e){t.chartengine_set_elliott_manual_cursor(this.__mrd_ptr,_,e)}set_elliott_preview(_,e,r,n,s,i,a){t.chartengine_set_elliott_preview(this.__mrd_ptr,_,e,r,n,s,i,a)}set_es_ema1_len(_){t.chartengine_set_es_ema1_len(this.__mrd_ptr,_)}set_es_ema2_len(_){t.chartengine_set_es_ema2_len(this.__mrd_ptr,_)}set_es_show_bos(_){t.chartengine_set_es_show_bos(this.__mrd_ptr,_)}set_es_show_ema1(_){t.chartengine_set_es_show_ema1(this.__mrd_ptr,_)}set_es_show_ema2(_){t.chartengine_set_es_show_ema2(this.__mrd_ptr,_)}set_es_show_wma(_){t.chartengine_set_es_show_wma(this.__mrd_ptr,_)}set_es_swing_len(_){t.chartengine_set_es_swing_len(this.__mrd_ptr,_)}set_es_wma_len(_){t.chartengine_set_es_wma_len(this.__mrd_ptr,_)}set_fib_ext_preview(_,e,r,n,s,i,a,c,h,g,m,u){t.chartengine_set_fib_ext_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,h,g,m,u)}set_footprint_tick_size(_){t.chartengine_set_footprint_tick_size(this.__mrd_ptr,_)}set_forex_signals_mode(_){t.chartengine_set_forex_signals_mode(this.__mrd_ptr,_)}set_forex_signals_setup(_){t.chartengine_set_forex_signals_setup(this.__mrd_ptr,_)}set_forex_signals_show_stats(_){t.chartengine_set_forex_signals_show_stats(this.__mrd_ptr,_)}set_fr_agg_data(_,e){const r=p(_,t.__wbindgen_export),n=d,s=p(e,t.__wbindgen_export),i=d;t.chartengine_set_fr_agg_data(this.__mrd_ptr,r,n,s,i)}set_fr_binance_data(_,e){const r=p(_,t.__wbindgen_export),n=d,s=p(e,t.__wbindgen_export),i=d;t.chartengine_set_fr_binance_data(this.__mrd_ptr,r,n,s,i)}set_fr_ratio(_){t.chartengine_set_fr_ratio(this.__mrd_ptr,_)}set_fr_show_agg(_){t.chartengine_set_fr_show_agg(this.__mrd_ptr,_)}set_fr_show_sma(_){t.chartengine_set_fr_show_sma(this.__mrd_ptr,_)}set_heatmap(_,e,r,n,s,i,a){const c=p(_,t.__wbindgen_export),h=d;t.chartengine_set_heatmap(this.__mrd_ptr,c,h,e,r,n,s,i,a)}set_heatmap_prefetch_range(_){t.chartengine_set_heatmap_prefetch_range(this.__mrd_ptr,_)}set_heatmap_range(_,e){t.chartengine_set_heatmap_range(this.__mrd_ptr,_,e)}set_hover_price(_){t.chartengine_set_hover_price(this.__mrd_ptr,_)}set_iceberg_events(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=d,h=p(e,t.__wbindgen_export),g=d,m=p(r,t.__wbindgen_export),u=d,f=p(n,t.__wbindgen_export),x=d,k=J(s,t.__wbindgen_export),z=d,I=G(i,t.__wbindgen_export),q=d;t.chartengine_set_iceberg_events(this.__mrd_ptr,a,c,h,g,m,u,f,x,k,z,I,q)}set_klines(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=d,h=p(e,t.__wbindgen_export),g=d,m=p(r,t.__wbindgen_export),u=d,f=p(n,t.__wbindgen_export),x=d,k=p(s,t.__wbindgen_export),z=d,I=p(i,t.__wbindgen_export),q=d;t.chartengine_set_klines(this.__mrd_ptr,a,c,h,g,m,u,f,x,k,z,I,q)}set_large_trades_data(_){const e=p(_,t.__wbindgen_export),r=d;t.chartengine_set_large_trades_data(this.__mrd_ptr,e,r)}set_license_state(_,e,r){t.chartengine_set_license_state(this.__mrd_ptr,_,e,r)}set_liq_heatmap_cell_height(_){t.chartengine_set_liq_heatmap_cell_height(this.__mrd_ptr,_)}set_liq_heatmap_filled_pct(_){t.chartengine_set_liq_heatmap_filled_pct(this.__mrd_ptr,_)}set_liq_heatmap_filled_zones(_){t.chartengine_set_liq_heatmap_filled_zones(this.__mrd_ptr,_)}set_liq_heatmap_predictions(_){t.chartengine_set_liq_heatmap_predictions(this.__mrd_ptr,_)}set_liq_heatmap_profile(_){t.chartengine_set_liq_heatmap_profile(this.__mrd_ptr,_)}set_liq_heatmap_range(_,e){t.chartengine_set_liq_heatmap_range(this.__mrd_ptr,_,e)}set_live_signals_data(_){const e=p(_,t.__wbindgen_export),r=d;t.chartengine_set_live_signals_data(this.__mrd_ptr,e,r)}set_live_signals_leverage(_){t.chartengine_set_live_signals_leverage(this.__mrd_ptr,_)}set_live_signals_loading(_){t.chartengine_set_live_signals_loading(this.__mrd_ptr,_)}set_live_signals_pip_value(_){t.chartengine_set_live_signals_pip_value(this.__mrd_ptr,_)}set_live_signals_show_entry(_){t.chartengine_set_live_signals_show_entry(this.__mrd_ptr,_)}set_live_signals_show_labels(_){t.chartengine_set_live_signals_show_labels(this.__mrd_ptr,_)}set_live_signals_show_max_profit(_){t.chartengine_set_live_signals_show_max_profit(this.__mrd_ptr,_)}set_live_signals_show_tp_sl(_){t.chartengine_set_live_signals_show_tp_sl(this.__mrd_ptr,_)}set_live_signals_show_zones(_){t.chartengine_set_live_signals_show_zones(this.__mrd_ptr,_)}set_live_signals_text_size(_){t.chartengine_set_live_signals_text_size(this.__mrd_ptr,_)}set_live_signals_trial(_){t.chartengine_set_live_signals_trial(this.__mrd_ptr,_)}set_lt_bubble_scale(_){t.chartengine_set_lt_bubble_scale(this.__mrd_ptr,_)}set_lt_volume_filter(_,e){t.chartengine_set_lt_volume_filter(this.__mrd_ptr,_,e)}set_oi_data(_){const e=p(_,t.__wbindgen_export),r=d;t.chartengine_set_oi_data(this.__mrd_ptr,e,r)}set_oi_data_ts(_,e){const r=p(_,t.__wbindgen_export),n=d,s=p(e,t.__wbindgen_export),i=d;t.chartengine_set_oi_data_ts(this.__mrd_ptr,r,n,s,i)}set_oi_display_mode(_){t.chartengine_set_oi_display_mode(this.__mrd_ptr,_)}set_oi_ratio(_){t.chartengine_set_oi_ratio(this.__mrd_ptr,_)}set_oi_show_on_chart(_){t.chartengine_set_oi_show_on_chart(this.__mrd_ptr,_)}set_path_cursor(_,e){t.chartengine_set_path_cursor(this.__mrd_ptr,_,e)}set_price_precision(_){t.chartengine_set_price_precision(this.__mrd_ptr,_)}set_real_timestamps(_){const e=p(_,t.__wbindgen_export),r=d;t.chartengine_set_real_timestamps(this.__mrd_ptr,e,r)}set_replay_hovered(_){t.chartengine_set_replay_hovered(this.__mrd_ptr,_)}set_replay_preview(_){t.chartengine_set_replay_preview(this.__mrd_ptr,_)}set_replay_state(_,e,r){t.chartengine_set_replay_state(this.__mrd_ptr,_,e,r)}set_rsi_period(_){t.chartengine_set_rsi_period(this.__mrd_ptr,_)}set_rsi_ratio(_){t.chartengine_set_rsi_ratio(this.__mrd_ptr,_)}set_rsi_show_divergence(_){t.chartengine_set_rsi_show_divergence(this.__mrd_ptr,_)}set_rsi_show_ema(_){t.chartengine_set_rsi_show_ema(this.__mrd_ptr,_)}set_rsi_show_signals(_){t.chartengine_set_rsi_show_signals(this.__mrd_ptr,_)}set_rsi_show_traps(_){t.chartengine_set_rsi_show_traps(this.__mrd_ptr,_)}set_rsi_show_wma(_){t.chartengine_set_rsi_show_wma(this.__mrd_ptr,_)}set_rsi_smoothing(_){t.chartengine_set_rsi_smoothing(this.__mrd_ptr,_)}set_si_show_icebergs(_){t.chartengine_set_si_show_icebergs(this.__mrd_ptr,_)}set_si_show_stops(_){t.chartengine_set_si_show_stops(this.__mrd_ptr,_)}set_si_show_zones(_){t.chartengine_set_si_show_zones(this.__mrd_ptr,_)}set_sr_fvg_extend(_){t.chartengine_set_sr_fvg_extend(this.__mrd_ptr,_)}set_sr_fvg_htf(_){t.chartengine_set_sr_fvg_htf(this.__mrd_ptr,_)}set_sr_fvg_mitigation(_){t.chartengine_set_sr_fvg_mitigation(this.__mrd_ptr,_)}set_sr_fvg_theme(_){t.chartengine_set_sr_fvg_theme(this.__mrd_ptr,_)}set_sr_htf_minutes(_){t.chartengine_set_sr_htf_minutes(this.__mrd_ptr,_)}set_sr_mitigation(_){t.chartengine_set_sr_mitigation(this.__mrd_ptr,_)}set_sr_ob_last(_){t.chartengine_set_sr_ob_last(this.__mrd_ptr,_)}set_sr_show_breakers(_){t.chartengine_set_sr_show_breakers(this.__mrd_ptr,_)}set_sr_show_fvg(_){t.chartengine_set_sr_show_fvg(this.__mrd_ptr,_)}set_sr_show_fvg_signals(_){t.chartengine_set_sr_show_fvg_signals(this.__mrd_ptr,_)}set_sr_show_htf_ob(_){t.chartengine_set_sr_show_htf_ob(this.__mrd_ptr,_)}set_sr_show_metrics(_){t.chartengine_set_sr_show_metrics(this.__mrd_ptr,_)}set_sr_show_ob(_){t.chartengine_set_sr_show_ob(this.__mrd_ptr,_)}set_sr_show_ob_activity(_){t.chartengine_set_sr_show_ob_activity(this.__mrd_ptr,_)}set_sr_show_ob_signals(_){t.chartengine_set_sr_show_ob_signals(this.__mrd_ptr,_)}set_sr_show_predict(_){t.chartengine_set_sr_show_predict(this.__mrd_ptr,_)}set_sr_show_smart_rev(_){t.chartengine_set_sr_show_smart_rev(this.__mrd_ptr,_)}set_sr_smart_rev_htf(_){t.chartengine_set_sr_smart_rev_htf(this.__mrd_ptr,_)}set_sr_stats_position(_){t.chartengine_set_sr_stats_position(this.__mrd_ptr,_)}set_sr_stats_type(_){t.chartengine_set_sr_stats_type(this.__mrd_ptr,_)}set_sr_text_size(_){t.chartengine_set_sr_text_size(this.__mrd_ptr,_)}set_theme(_){t.chartengine_set_theme(this.__mrd_ptr,_)}set_tpo_ib(_){t.chartengine_set_tpo_ib(this.__mrd_ptr,_)}set_tpo_ib_minutes(_){t.chartengine_set_tpo_ib_minutes(this.__mrd_ptr,_)}set_tpo_letter_minutes(_){t.chartengine_set_tpo_letter_minutes(this.__mrd_ptr,_)}set_tpo_naked_poc(_){t.chartengine_set_tpo_naked_poc(this.__mrd_ptr,_)}set_tpo_period(_){t.chartengine_set_tpo_period(this.__mrd_ptr,_)}set_tpo_poc_line(_){t.chartengine_set_tpo_poc_line(this.__mrd_ptr,_)}set_tpo_profile_shape(_){t.chartengine_set_tpo_profile_shape(this.__mrd_ptr,_)}set_tpo_signals(_){t.chartengine_set_tpo_signals(this.__mrd_ptr,_)}set_tpo_single_prints(_){t.chartengine_set_tpo_single_prints(this.__mrd_ptr,_)}set_tpo_va_lines(_){t.chartengine_set_tpo_va_lines(this.__mrd_ptr,_)}set_volume_color_mode(_){t.chartengine_set_volume_color_mode(this.__mrd_ptr,_)}set_volume_ma_period(_){t.chartengine_set_volume_ma_period(this.__mrd_ptr,_)}set_volume_show_ma(_){t.chartengine_set_volume_show_ma(this.__mrd_ptr,_)}set_volume_show_signals(_){t.chartengine_set_volume_show_signals(this.__mrd_ptr,_)}set_vpin_bucket_size(_){t.chartengine_set_vpin_bucket_size(this.__mrd_ptr,_)}set_vpin_data(_,e){const r=p(_,t.__wbindgen_export),n=d,s=p(e,t.__wbindgen_export),i=d;t.chartengine_set_vpin_data(this.__mrd_ptr,r,n,s,i)}set_vpin_num_buckets(_){t.chartengine_set_vpin_num_buckets(this.__mrd_ptr,_)}set_vpin_ratio(_){t.chartengine_set_vpin_ratio(this.__mrd_ptr,_)}set_vpin_show_sma(_){t.chartengine_set_vpin_show_sma(this.__mrd_ptr,_)}set_vpin_show_zones(_){t.chartengine_set_vpin_show_zones(this.__mrd_ptr,_)}set_vpin_threshold(_){t.chartengine_set_vpin_threshold(this.__mrd_ptr,_)}set_vrvp_poc_line(_){t.chartengine_set_vrvp_poc_line(this.__mrd_ptr,_)}show_latest(_){t.chartengine_show_latest(this.__mrd_ptr,_)}start_brush(_,e,r,n,s){t.chartengine_start_brush(this.__mrd_ptr,_,e,r,n,s)}start_elliott_manual(_,e,r,n,s){t.chartengine_start_elliott_manual(this.__mrd_ptr,_,e,r,n,s)}start_path(_,e,r,n,s,i){t.chartengine_start_path(this.__mrd_ptr,_,e,r,n,s,i)}update_drawing_anchor(_,e,r){t.chartengine_update_drawing_anchor(this.__mrd_ptr,_,e,r)}update_heatmap_column(_,e){const r=p(e,t.__wbindgen_export),n=d;t.chartengine_update_heatmap_column(this.__mrd_ptr,_,r,n)}update_heatmap_column_at(_,e,r,n){const s=p(_,t.__wbindgen_export),i=d;t.chartengine_update_heatmap_column_at(this.__mrd_ptr,s,i,e,r,n)}update_last_heatmap_column(_,e,r){const n=p(_,t.__wbindgen_export),s=d;t.chartengine_update_last_heatmap_column(this.__mrd_ptr,n,s,e,r)}update_last_kline(_,e,r,n,s,i){t.chartengine_update_last_kline(this.__mrd_ptr,_,e,r,n,s,i)}vpin_to_screen_y(_){return t.chartengine_vpin_to_screen_y(this.__mrd_ptr,_)}vrvp_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_vrvp_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}world_to_screen_x(_){return t.chartengine_world_to_screen_x(this.__mrd_ptr,_)}world_to_screen_y(_){return t.chartengine_world_to_screen_y(this.__mrd_ptr,_)}zoom(_,e,r){t.chartengine_zoom(this.__mrd_ptr,_,e,r)}zoom_indicator_y(_,e,r){t.chartengine_zoom_indicator_y(this.__mrd_ptr,_,e,r)}zoom_x(_,e){t.chartengine_zoom_x(this.__mrd_ptr,_,e)}zoom_y(_,e){t.chartengine_zoom_y(this.__mrd_ptr,_,e)}}Symbol.dispose&&(D.prototype[Symbol.dispose]=D.prototype.free);function r_(){const o=t.wasm_memory();return K(o)}function U(){return{__proto__:null,"./chart_engine_bg.js":{__proto__:null,__mrd___wbindgen_memory_edb3f01e3930bbf6:function(){const _=t.memory;return V(_)},__mrd___wbindgen_throw_6ddd609b62940d55:function(_,e){throw new Error(b(_,e))}}}}const L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__mrd_chartengine_free(o>>>0,1));function V(o){F===w.length&&w.push(w.length+1);const _=F;return F=w[_],w[_]=o,_}function P(o){o<1028||(w[o]=F,F=o)}function y(o,_){return o=o>>>0,C().subarray(o/8,o/8+_)}function H(o,_){return o=o>>>0,N().subarray(o/4,o/4+_)}let v=null;function l(){return(v===null||v.buffer.detached===!0||v.buffer.detached===void 0&&v.buffer!==t.memory.buffer)&&(v=new DataView(t.memory.buffer)),v}let A=null;function C(){return(A===null||A.byteLength===0)&&(A=new Float64Array(t.memory.buffer)),A}let M=null;function N(){return(M===null||M.byteLength===0)&&(M=new Int32Array(t.memory.buffer)),M}function b(o,_){return o=o>>>0,Z(o,_)}let W=null;function X(){return(W===null||W.byteLength===0)&&(W=new Uint32Array(t.memory.buffer)),W}let j=null;function O(){return(j===null||j.byteLength===0)&&(j=new Uint8Array(t.memory.buffer)),j}function Y(o){return w[o]}let w=new Array(1024).fill(void 0);w.push(void 0,null,!0,!1);let F=w.length;function G(o,_){const e=_(o.length*4,4)>>>0;return X().set(o,e/4),d=o.length,e}function J(o,_){const e=_(o.length*1,1)>>>0;return O().set(o,e/1),d=o.length,e}function p(o,_){const e=_(o.length*8,8)>>>0;return C().set(o,e/8),d=o.length,e}function R(o,_,e){if(e===void 0){const a=T.encode(o),c=_(a.length,1)>>>0;return O().subarray(c,c+a.length).set(a),d=a.length,c}let r=o.length,n=_(r,1)>>>0;const s=O();let i=0;for(;i<r;i++){const a=o.charCodeAt(i);if(a>127)break;s[n+i]=a}if(i!==r){i!==0&&(o=o.slice(i)),n=e(n,r,r=i+o.length*3,1)>>>0;const a=O().subarray(n+i,n+r),c=T.encodeInto(o,a);i+=c.written,n=e(n,r,i,1)>>>0}return d=i,n}function K(o){const _=Y(o);return P(o),_}let S=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});S.decode();const Q=2146435072;let E=0;function Z(o,_){return E+=_,E>=Q&&(S=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),S.decode(),E=_),S.decode(O().subarray(o,o+_))}const T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(o,_){const e=T.encode(o);return _.set(e),{read:o.length,written:e.length}});let d=0,$,t;function B(o,_){return t=o.exports,$=_,v=null,A=null,M=null,W=null,j=null,t}async function __(o,_){if(typeof Response=="function"&&o instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(o,_)}catch(n){if(o.ok&&e(o.type)&&o.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const r=await o.arrayBuffer();return await WebAssembly.instantiate(r,_)}else{const r=await WebAssembly.instantiate(o,_);return r instanceof WebAssembly.Instance?{instance:r,module:o}:r}function e(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function t_(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module:o}=o:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const _=U();o instanceof WebAssembly.Module||(o=new WebAssembly.Module(o));const e=new WebAssembly.Instance(o,_);return B(e,o)}async function e_(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module_or_path:o}=o:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),o===void 0&&(o=new URL("chart_engine_bg.wasm",import.meta.url));const _=U();(typeof o=="string"||typeof Request=="function"&&o instanceof Request||typeof URL=="function"&&o instanceof URL)&&(o=fetch(o));const{instance:e,module:r}=await __(await o,_);return B(e,r)}export{D as ChartEngine,e_ as default,t_ as initSync,r_ as wasm_memory};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var P={FILL_RECT:1,STROKE_RECT:2,LINE:3,DASHED_LINE:4,POLYLINE:5,TEXT:6,CIRCLE:7,TRIANGLE:8,SAVE:9,RESTORE:10,CLIP_RECT:11,ROTATED_TEXT:12,BUBBLE_3D:13,FILL_POLYGON:14,DASHED_POLYLINE:15,END_FRAME:255},Te=["left","center","right"],wt=new Map,Ee=4096;function ye(t,o,i,s){return t<<24|o<<16|i<<8|s}function Y(t,o,i,s){let p=ye(t,o,i,s),e=wt.get(p);return e||(e=`rgba(${t},${o},${i},${(s/255).toFixed(3)})`,wt.size>=Ee&&wt.clear(),wt.set(p,e),e)}var Vt=new TextDecoder;function nt(t,o,i,s){let p=o.buffer;if(i+s>p.byteLength)return;let e=new DataView(p,i,s),n=new Uint8Array(p,i,s),r=0,a="",u="",l=-1,g="";for(;r<s;){let f=n[r];if(r+=1,f===P.END_FRAME)break;switch(f){case P.FILL_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4,w!==a&&(t.fillStyle=w,a=w),t.fillRect(d,_,c,h);break}case P.STROKE_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let m=e.getFloat32(r,!0);r+=4,w!==u&&(t.strokeStyle=w,u=w),m!==l&&(t.lineWidth=m,l=m),t.strokeRect(d,_,c,h);break}case P.LINE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let m=e.getFloat32(r,!0);r+=4,t.beginPath(),w!==u&&(t.strokeStyle=w,u=w),m!==l&&(t.lineWidth=m,l=m),t.setLineDash([]),t.moveTo(d,_),t.lineTo(c,h),t.stroke();break}case P.DASHED_LINE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let m=e.getFloat32(r,!0);r+=4;let L=e.getFloat32(r,!0);r+=4;let S=e.getFloat32(r,!0);r+=4,t.beginPath(),w!==u&&(t.strokeStyle=w,u=w),m!==l&&(t.lineWidth=m,l=m),t.setLineDash([L,S]),t.moveTo(d,_),t.lineTo(c,h),t.stroke(),t.setLineDash([]);break}case P.POLYLINE:{let d=e.getUint16(r,!0);r+=2;let _=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let c=e.getFloat32(r,!0);if(r+=4,d>0){let h=new Float32Array(d*2);for(let w=0;w<d;w++)h[w*2]=e.getFloat32(r,!0),r+=4,h[w*2+1]=e.getFloat32(r,!0),r+=4;if(t.beginPath(),_!==u&&(t.strokeStyle=_,u=_),c!==l&&(t.lineWidth=c,l=c),t.setLineDash([]),t.lineJoin="round",t.lineCap="round",d<=3){t.moveTo(h[0],h[1]);for(let w=1;w<d;w++)t.lineTo(h[w*2],h[w*2+1])}else{t.moveTo(h[0],h[1]),t.lineTo((h[0]+h[2])*.5,(h[1]+h[3])*.5);for(let w=1;w<d-1;w++){let m=h[w*2],L=h[w*2+1],S=h[(w+1)*2],C=h[(w+1)*2+1];t.quadraticCurveTo(m,L,(m+S)*.5,(L+C)*.5)}t.lineTo(h[(d-1)*2],h[(d-1)*2+1])}t.stroke()}break}case P.TEXT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=n[r];r+=1;let m=e.getUint16(r,!0);r+=2;let L=Vt.decode(new Uint8Array(o.buffer,i+r,m));r+=m,c!==a&&(t.fillStyle=c,a=c);let S=`${h}px "IBM Plex Mono",monospace`;S!==g&&(t.font=S,g=S),t.textAlign=Te[w]||"left",t.textBaseline="middle",t.fillText(L,d,_);break}case P.CIRCLE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let m=e.getFloat32(r,!0);r+=4,t.beginPath(),t.arc(d,_,c,0,Math.PI*2),h!==a&&(t.fillStyle=h,a=h),t.fill(),m>0&&(w!==u&&(t.strokeStyle=w,u=w),m!==l&&(t.lineWidth=m,l=m),t.stroke());break}case P.TRIANGLE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);r+=4;let m=e.getFloat32(r,!0);r+=4;let L=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4,t.beginPath(),t.moveTo(d,_),t.lineTo(c,h),t.lineTo(w,m),t.closePath(),L!==a&&(t.fillStyle=L,a=L),t.fill();break}case P.SAVE:{t.save();break}case P.RESTORE:{t.restore(),a="",u="",l=-1,g="";break}case P.CLIP_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4,t.beginPath(),t.rect(d,_,c,h),t.clip();break}case P.ROTATED_TEXT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);r+=4;let m=e.getUint16(r,!0);r+=2;let L=Vt.decode(n.subarray(r,r+m));r+=m;let S=`${h}px sans-serif`;S!==g&&(t.font=S,g=S),c!==a&&(t.fillStyle=c,a=c),t.textAlign="center",t.textBaseline="middle",t.save(),t.translate(d,_),t.rotate(w),t.fillText(L,0,0),t.restore();break}case P.BUBBLE_3D:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=n[r],w=n[r+1],m=n[r+2],L=n[r+3];r+=4;let S=n[r],C=n[r+1],N=n[r+2],U=n[r+3];r+=4;let T=n[r],x=n[r+1],$=n[r+2],ct=n[r+3];r+=4;let It=e.getFloat32(r,!0);r+=4;let E=c;if(E<10){let Z=`rgba(${h},${w},${m},${(L/255).toFixed(3)})`;t.beginPath(),t.arc(d,_,E,0,Math.PI*2),t.fillStyle=Z,t.fill(),a=""}else if(E<18){let Z=d-E*.25,W=_-E*.25,H=t.createRadialGradient(Z,W,E*.08,d,_,E);H.addColorStop(0,`rgba(${S},${C},${N},${(U/255).toFixed(3)})`),H.addColorStop(1,`rgba(${h},${w},${m},${(L/255).toFixed(3)})`),t.beginPath(),t.arc(d,_,E,0,Math.PI*2),t.fillStyle=H,t.fill(),a=""}else{let Z=d-E*.25,W=_-E*.25,H=t.createRadialGradient(d,_,E*.85,d,_,E*1.2);H.addColorStop(0,`rgba(${T},${x},${$},${(ct/255*.5).toFixed(3)})`),H.addColorStop(1,`rgba(${T},${x},${$},0)`),t.beginPath(),t.arc(d,_,E*1.2,0,Math.PI*2),t.fillStyle=H,t.fill();let O=t.createRadialGradient(Z,W,E*.08,d,_,E);O.addColorStop(0,`rgba(${S},${C},${N},${(U/255).toFixed(3)})`),O.addColorStop(1,`rgba(${h},${w},${m},${(L/255).toFixed(3)})`),t.beginPath(),t.arc(d,_,E,0,Math.PI*2),t.fillStyle=O,t.fill();let st=E*.2,J=t.createRadialGradient(Z,W,0,Z,W,st);J.addColorStop(0,"rgba(255,255,255,0.22)"),J.addColorStop(1,"rgba(255,255,255,0)"),t.beginPath(),t.arc(Z,W,st,0,Math.PI*2),t.fillStyle=J,t.fill(),a=""}break}case P.FILL_POLYGON:{let d=e.getUint16(r,!0);r+=2;let _=Y(n[r],n[r+1],n[r+2],n[r+3]);if(r+=4,d>2){t.beginPath();let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4,t.moveTo(c,h);for(let w=1;w<d;w++)t.lineTo(e.getFloat32(r,!0),e.getFloat32(r+4,!0)),r+=8;t.closePath(),_!==a&&(t.fillStyle=_,a=_),t.fill()}else r+=d*8;break}case P.DASHED_POLYLINE:{let d=e.getUint16(r,!0);r+=2;let _=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);if(r+=4,d>1){t.beginPath(),_!==u&&(t.strokeStyle=_,u=_),c!==l&&(t.lineWidth=c,l=c),t.setLineDash([h,w]),t.lineJoin="round";let m=e.getFloat32(r,!0);r+=4;let L=e.getFloat32(r,!0);r+=4,t.moveTo(m,L);for(let S=1;S<d;S++)t.lineTo(e.getFloat32(r,!0),e.getFloat32(r+4,!0)),r+=8;t.stroke(),t.setLineDash([])}else r+=d*8;break}default:return}}}var z={trendline:{type:"2point",previewKind:0,addFn:"add_trendline"},arrow:{type:"2point",previewKind:4,addFn:"add_arrow"},measure:{type:"2point",previewKind:2,addFn:"add_price_range"},fib:{type:"2point",previewKind:3,addFn:"add_fib_retracement"},long:{type:"2point",previewKind:5,addFn:"add_long_position"},short:{type:"2point",previewKind:5,addFn:"add_short_position"},hline:{type:"1point_xp",previewKind:1,addFn:"add_horizontal_line"},vwap:{type:"1point_x",previewKind:6,addFn:"add_anchored_vwap"},pricelabel:{type:"1point_xy",previewKind:7,addFn:"add_price_label"},circle:{type:"2point",previewKind:8,addFn:"add_circle"},arrowup:{type:"1point_xy",previewKind:9,addFn:"add_arrow_marker_up"},arrowdown:{type:"1point_xy",previewKind:10,addFn:"add_arrow_marker_down"},textnote:{type:"1point_xy",previewKind:11,addFn:"add_text_note"},channel:{type:"3point",previewKind:0,addFn:"add_parallel_channel"},fibext:{type:"3point",previewKind:0,addFn:"add_fib_extension",previewFn:"fib_ext"},brush:{type:"freehand"},path:{type:"npoint"},elliott:{type:"elliott_manual"},elliottauto:{type:"1point_xy",previewKind:12,addFn:"add_elliott_impulse",previewFn:"elliott"}};function at(t){return z[t]?.type==="2point"}function lt(t){return z[t]?.type==="3point"}function tt(t){let o=z[t]?.type;return o==="1point"||o==="1point_x"||o==="1point_xy"||o==="1point_xp"}function gt(t){return z[t]?.type==="freehand"}function V(t){return z[t]?.type==="npoint"}function B(t){return z[t]?.type==="elliott_manual"}var Bt={r:.04,g:.49,b:1,lineWidth:2,dashed:!1,fontSize:12};function G(t,o,i,s,p,e){e=e||Bt;let n=z[o];if(!n)return 0;let r=0;return n.type==="3point"?r=t[n.addFn](i.x1,i.y1,i.x2,i.y2,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane):n.type==="2point"?r=t[n.addFn](i.x1,i.y1,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane):n.type==="1point_x"?r=t[n.addFn](s,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane):n.type==="1point_xp"?r=t[n.addFn](s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane):n.type==="1point_xy"?r=t[n.addFn](s,p,e.r,e.g,e.b,e.fontSize||12,i.pane):r=t[n.addFn](p,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane),r||0}function D(t,o,i,s,p,e,n){e=e||Bt;let r=z[o];if(r){if(r.previewFn==="elliott"){t.set_elliott_preview(s,p,e.r,e.g,e.b,e.lineWidth,n);return}r.type==="3point"?i.step===1?t.set_drawing_preview(r.previewKind,i.x1,i.y1,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,n):i.step===2&&(r.previewFn==="fib_ext"?t.set_fib_ext_preview(i.x1,i.y1,i.x2,i.y2,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,n):t.set_channel_preview(i.x1,i.y1,i.x2,i.y2,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,n)):r.type==="2point"?t.set_drawing_preview(r.previewKind,i.x1,i.y1,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,n):r.type==="1point_x"?t.set_drawing_preview(r.previewKind,s,0,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,n):r.type==="1point_xp"||r.type==="1point_xy"?t.set_drawing_preview(r.previewKind,s,p,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,n):t.set_drawing_preview(r.previewKind,0,p,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,n)}}function v(t,o,i,s){let p=t.screen_to_world_x(o),e;switch(s){case 1:e=t.screen_to_rsi_y(i);break;case 2:e=t.screen_to_oi_y(i);break;case 3:e=t.screen_to_fr_y(i);break;case 4:e=t.screen_to_cvd_y(i);break;case 5:e=t.screen_to_vpin_y(i);break;default:e=t.screen_to_world_y(i);break}return{wx:p,wy:e}}function X(t){return t===4?1:t===6?2:t===8?3:t===10?4:t===12?5:0}function F(t){return t===0||t===4||t===6||t===8||t===10||t===12}function $t(t,o,i,s){t.addEventListener("wheel",r=>{if(s.disposed)return;r.preventDefault(),s.cancelMomentum();let a=r.deltaY>0?1.1:.9,u=o.hit_zone(r.offsetX,r.offsetY);r.ctrlKey?o.zoom_y(r.offsetY,a):r.shiftKey||u===2?o.zoom_x(r.offsetX,a):u===3?o.zoom_y(r.offsetY,a):o.zoom(r.offsetX,r.offsetY,a),i.onDirty()},{passive:!1}),t.addEventListener("mousedown",r=>{if(s.disposed||r.button!==0)return;s.cancelMomentum(),e();let a=performance.now();if(a-s.lastClickTime<300){s.lastClickTime=a;return}s.lastClickTime=a;let u=s.drawingMode;if(u){let g=o.hit_zone(r.offsetX,r.offsetY);if(!F(g))return;let f=X(g),{wx:d,wy:_}=v(o,r.offsetX,r.offsetY,f),c=u.style,h=u.tool;if(B(h)){if(!u.pathStarted)u.pane=f,o.start_elliott_manual(c.r,c.g,c.b,c.lineWidth,f),o.add_elliott_manual_point(d,_),u.pathStarted=!0,u.step=1;else if(o.add_elliott_manual_point(d,_)){s.finishDrawing(),i.onDirty();return}}else if(V(h))u.pathStarted?o.add_path_point(d,_):(u.pane=f,o.start_path(c.r,c.g,c.b,c.lineWidth,c.dashed,f),o.add_path_point(d,_),u.pathStarted=!0,u.step=1);else if(gt(h))u.pane=f,o.start_brush(c.r,c.g,c.b,c.lineWidth,f),o.add_brush_point(d,_),s.isBrushing=!0;else if(lt(h))if(u.step===0)u.x1=d,u.y1=_,u.pane=f,u.step=1;else if(u.step===1)u.x2=d,u.y2=_,u.step=2,o.clear_drawing_preview();else{let w=z[h];w&&w.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),G(o,h,u,d,_,c),s.finishDrawing()}else if(at(h))u.step===0?(u.x1=d,u.y1=_,u.pane=f,u.step=1):(G(o,h,u,d,_,c),s.finishDrawing());else{u.pane=f;let w=G(o,h,u,d,_,c);s.finishDrawing(),h==="textnote"&&w>0&&(o.select_drawing(w),i.onDrawingSelected?.(w),i.onDrawingDblClick?.(w,r.offsetX,r.offsetY,r.clientX,r.clientY))}i.onDirty();return}let l=o.hit_zone(r.offsetX,r.offsetY);if(l===5){s.isResizingRsi=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_rsi_ratio(),t.style.cursor="ns-resize";return}if(l===7){s.isResizingOi=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_oi_ratio(),t.style.cursor="ns-resize";return}if(l===9){s.isResizingFr=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_fr_ratio(),t.style.cursor="ns-resize";return}if(l===11){s.isResizingCvd=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_cvd_ratio(),t.style.cursor="ns-resize";return}if(l===13){s.isResizingVpin=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_vpin_ratio(),t.style.cursor="ns-resize";return}if(F(l)){let g=o.get_selected_drawing();if(g>0){let h=o.hit_test_drawing_anchor(r.offsetX,r.offsetY);if(h>=0){s.isDraggingAnchor=!0,s.dragAnchorIdx=h,s.dragAnchorPane=X(l),t.style.cursor="grabbing";return}if(o.hit_test_drawing(r.offsetX,r.offsetY)===g){s.isDraggingDrawing=!0,s.dragDrawingPane=X(l);let{wx:m,wy:L}=v(o,r.offsetX,r.offsetY,s.dragDrawingPane);s.dragDrawingLastWx=m,s.dragDrawingLastWy=L,t.style.cursor="move";return}}let f=o.hit_test_drawing(r.offsetX,r.offsetY);if(f>0){o.deselect_marker(),i.onMarkerSelected?.(0),o.select_drawing(f),i.onDrawingSelected?.(f),i.onDirty();return}let d=o.hit_test_marker(r.offsetX,r.offsetY);if(d>0){o.deselect_drawing(),i.onDrawingSelected?.(0),o.select_marker(d),i.onMarkerSelected?.(d),i.onDirty();return}let _=o.get_selected_drawing(),c=o.get_selected_marker();_>0&&(o.deselect_drawing(),i.onDrawingSelected?.(0),i.onDirty()),c>0&&(o.deselect_marker(),i.onMarkerSelected?.(0),i.onDirty())}F(l)&&(s.liqPinSx=r.offsetX,s.liqPinSy=r.offsetY,s.liqPinTimer&&clearTimeout(s.liqPinTimer),s.liqPinTimer=setTimeout(()=>{s.liqPinTimer=null,i.onLiqAnnotationPin?.(s.liqPinSx,s.liqPinSy)},700)),s.isDragging=!0,s.dragZone=l,s.lastX=r.offsetX,s.lastY=r.offsetY,l===2?t.style.cursor="ew-resize":l===3?t.style.cursor="ns-resize":t.style.cursor="grabbing"});let p=null;function e(){p&&(cancelAnimationFrame(p),p=null)}function n(r,a){let u=o.hover_hit_test(r,a),l=u[0],g=u[1],f=u[2],d=u[3],_=u[4],c=s.drawingMode;l===2?(t.style.cursor="ew-resize",o.hide_crosshair()):l===3?(t.style.cursor="ns-resize",o.hide_crosshair()):(o.set_crosshair(r,a),l===5||l===7||l===9||l===11||l===13?t.style.cursor="ns-resize":!c&&F(l)&&g>0&&f>=0?t.style.cursor="grab":!c&&F(l)&&g>0&&d===g?t.style.cursor="move":!c&&F(l)&&(d>0||_>0)?t.style.cursor="pointer":t.style.cursor="crosshair"),i.onDirty(),i.onCrosshairMove?.(r,a,l),i.onVrvpHover?.(r,a)}t.addEventListener("mousemove",r=>{if(s.disposed)return;if(s.liqPinTimer){let u=Math.abs(r.offsetX-s.liqPinSx),l=Math.abs(r.offsetY-s.liqPinSy);(u>6||l>6)&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null)}if(s.isResizingRsi){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_rsi_ratio(d),i.onDirty();return}if(s.isResizingOi){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_oi_ratio(d),i.onDirty();return}if(s.isResizingFr){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_fr_ratio(d),i.onDirty();return}if(s.isResizingCvd){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_cvd_ratio(d),i.onDirty();return}if(s.isResizingVpin){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_vpin_ratio(d),i.onDirty();return}if(s.isDraggingAnchor){let{wx:u,wy:l}=v(o,r.offsetX,r.offsetY,s.dragAnchorPane);o.update_drawing_anchor(s.dragAnchorIdx,u,l),o.set_crosshair(r.offsetX,r.offsetY),i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,o.hit_zone(r.offsetX,r.offsetY));return}if(s.isDraggingDrawing){let{wx:u,wy:l}=v(o,r.offsetX,r.offsetY,s.dragDrawingPane),g=u-s.dragDrawingLastWx,f=l-s.dragDrawingLastWy;o.move_drawing(g,f),s.dragDrawingLastWx=u,s.dragDrawingLastWy=l,o.set_crosshair(r.offsetX,r.offsetY),i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,o.hit_zone(r.offsetX,r.offsetY));return}let a=s.drawingMode;if(s.isBrushing&&a){let u=a.pane||0,{wx:l,wy:g}=v(o,r.offsetX,r.offsetY,u);o.add_brush_point(l,g),o.set_crosshair(r.offsetX,r.offsetY),i.onDirty();return}if(a&&B(a.tool)&&a.pathStarted){let u=a.pane||0,{wx:l,wy:g}=v(o,r.offsetX,r.offsetY,u);o.set_elliott_manual_cursor(l,g),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(a&&V(a.tool)&&a.pathStarted){let u=a.pane||0,{wx:l,wy:g}=v(o,r.offsetX,r.offsetY,u);o.set_path_cursor(l,g),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(a&&a.step>0){let u=a.pane||0,{wx:l,wy:g}=v(o,r.offsetX,r.offsetY,u);D(o,a.tool,a,l,g,a.style,u),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(a&&tt(a.tool)){let u=o.hit_zone(r.offsetX,r.offsetY),l=X(u),{wx:g,wy:f}=v(o,r.offsetX,r.offsetY,l);D(o,a.tool,a,g,f,a.style,l),o.set_crosshair(r.offsetX,r.offsetY),i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,u);return}if(s.isDragging){let u=r.offsetX-s.lastX,l=r.offsetY-s.lastY;s.lastX=r.offsetX,s.lastY=r.offsetY,s.dragZone===2?o.pan_x(u):s.dragZone===3?o.pan_y(l):o.pan(u,l),i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,s.dragZone),i.onVrvpHover?.(r.offsetX,r.offsetY);return}s._pendingHoverX=r.offsetX,s._pendingHoverY=r.offsetY,p||(p=requestAnimationFrame(()=>{p=null,s.disposed||n(s._pendingHoverX,s._pendingHoverY)}))}),t.addEventListener("mouseup",()=>{s.disposed||(s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isBrushing&&(s.isBrushing=!1,o.finish_brush(),s.finishDrawing(),i.onDirty()),s.isDragging=!1,s.isResizingRsi=!1,s.isResizingOi=!1,s.isResizingFr=!1,s.isResizingCvd=!1,s.isResizingVpin=!1,s.isDraggingAnchor=!1,s.isDraggingDrawing=!1,s.dragAnchorIdx=-1,t.style.cursor="crosshair")}),t.addEventListener("mouseleave",()=>{s.disposed||(e(),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isBrushing&&(s.isBrushing=!1,o.finish_brush(),s.finishDrawing()),s.isDragging=!1,s.isResizingRsi=!1,s.isResizingOi=!1,s.isResizingFr=!1,s.isResizingCvd=!1,s.isResizingVpin=!1,s.isDraggingAnchor=!1,s.isDraggingDrawing=!1,s.dragAnchorIdx=-1,o.hide_crosshair(),t.style.cursor="crosshair",i.onDirty(),i.onCrosshairHide?.(),i.onVrvpHover?.(null,null))}),t.addEventListener("dblclick",r=>{if(s.disposed)return;r.preventDefault(),r.stopPropagation();let a=s.drawingMode;if(a&&B(a.tool)&&a.pathStarted){o.finish_elliott_manual(),s.finishDrawing(),i.onDirty();return}if(a&&V(a.tool)&&a.pathStarted){o.finish_path(),s.finishDrawing(),i.onDirty();return}if(a)return;let u=o.hit_test_drawing(r.offsetX,r.offsetY);u>0&&(o.select_drawing(u),i.onDirty(),i.onDrawingDblClick?.(u,r.offsetX,r.offsetY,r.clientX,r.clientY))}),t.addEventListener("contextmenu",r=>{if(s.disposed)return;let a=s.drawingMode;if(a&&B(a.tool)&&a.pathStarted){r.preventDefault(),r.stopPropagation(),o.finish_elliott_manual(),s.finishDrawing(),i.onDirty();return}if(a&&V(a.tool)&&a.pathStarted){r.preventDefault(),r.stopPropagation(),o.finish_path(),s.finishDrawing(),i.onDirty();return}})}function Jt(t,o,i,s){t.addEventListener("touchstart",p=>{if(!s.disposed){if(p.preventDefault(),s.cancelMomentum(),p.touches.length===2){clearTimeout(s.longPressTimer),s.isCrosshairMode=!1;let e=t.getBoundingClientRect(),n=p.touches[1].clientX-p.touches[0].clientX,r=p.touches[1].clientY-p.touches[0].clientY;s.lastTouchDist=Math.sqrt(n*n+r*r),s.lastX=(p.touches[0].clientX+p.touches[1].clientX)/2-e.left,s.lastY=(p.touches[0].clientY+p.touches[1].clientY)/2-e.top,s.dragZone=o.hit_zone(s.lastX,s.lastY)}else if(p.touches.length===1){let e=t.getBoundingClientRect(),n=p.touches[0].clientX-e.left,r=p.touches[0].clientY-e.top;s.touchStartX=n,s.touchStartY=r,s.touchMoved=!1;let a=s.drawingMode;if(a){let d=o.hit_zone(n,r);if(F(d)){let _=X(d),{wx:c,wy:h}=v(o,n,r,_),w=a.tool;if(B(w)){if(!a.pathStarted)a.pane=_,o.start_elliott_manual(a.style.r,a.style.g,a.style.b,a.style.lineWidth,_),o.add_elliott_manual_point(c,h),a.pathStarted=!0,a.step=1;else if(o.add_elliott_manual_point(c,h)){s.finishDrawing(),i.onDirty();return}}else V(w)?a.pathStarted?o.add_path_point(c,h):(a.pane=_,o.start_path(a.style.r,a.style.g,a.style.b,a.style.lineWidth,a.style.dashed,_),o.add_path_point(c,h),a.pathStarted=!0,a.step=1):gt(w)?(a.pane=_,o.start_brush(a.style.r,a.style.g,a.style.b,a.style.lineWidth,_),o.add_brush_point(c,h),s.isBrushing=!0):lt(w)?a.step===0?(a.x1=c,a.y1=h,a.pane=_,a.step=1,a._stepAtTouchStart=0,D(o,w,a,c,h,a.style,_)):a.step===1?(a._stepAtTouchStart=1,D(o,w,a,c,h,a.style,a.pane)):(a._stepAtTouchStart=2,D(o,w,a,c,h,a.style,a.pane)):at(w)?a.step===0?(a.x1=c,a.y1=h,a.pane=_,a.step=1,a._stepAtTouchStart=0,D(o,w,a,c,h,a.style,_)):(a._stepAtTouchStart=1,D(o,w,a,c,h,a.style,a.pane)):tt(w)?(a.pane=_,D(o,w,a,c,h,a.style,_)):(a.pane=_,G(o,w,a,c,h,a.style),s.finishDrawing());o.set_crosshair(n,r),i.onDirty(),i.onCrosshairMove?.(n,r,d)}return}let u=o.hover_hit_test(n,r),l=u[0],g=u[1],f=u[2];if(F(l)&&!s.drawingMode&&g>0){if(f>=0){s.isDraggingAnchor=!0,s.dragAnchorIdx=f,s.dragAnchorPane=X(l);return}if(u[3]===g){s.isDraggingDrawing=!0,s.dragDrawingPane=X(l);let{wx:_,wy:c}=v(o,n,r,s.dragDrawingPane);s.dragDrawingLastWx=_,s.dragDrawingLastWy=c;return}}s.isDragging=!0,s.isCrosshairMode=!1,s.lastX=n,s.lastY=r,s.dragZone=l,clearTimeout(s.longPressTimer),s.longPressTimer=setTimeout(()=>{s.isDragging&&!s.touchMoved&&(s.isCrosshairMode=!0,o.set_crosshair(n,r),i.onDirty(),i.onCrosshairMove?.(n,r,s.dragZone),i.onVrvpHover?.(n,r))},300),F(s.dragZone)&&(s.liqPinSx=n,s.liqPinSy=r,s.liqPinTimer&&clearTimeout(s.liqPinTimer),s.liqPinTimer=setTimeout(()=>{s.liqPinTimer=null,s.touchMoved||i.onLiqAnnotationPin?.(s.liqPinSx,s.liqPinSy)},700))}}},{passive:!1}),t.addEventListener("touchmove",p=>{if(s.disposed)return;p.preventDefault();let e=t.getBoundingClientRect();if(s.isDraggingAnchor&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,{wx:u,wy:l}=v(o,r,a,s.dragAnchorPane);o.update_drawing_anchor(s.dragAnchorIdx,u,l),o.set_crosshair(r,a),i.onDirty();return}if(s.isDraggingDrawing&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top;s.touchMoved=!0;let{wx:u,wy:l}=v(o,r,a,s.dragDrawingPane),g=u-s.dragDrawingLastWx,f=l-s.dragDrawingLastWy;o.move_drawing(g,f),s.dragDrawingLastWx=u,s.dragDrawingLastWy=l,o.set_crosshair(r,a),i.onDirty();return}let n=s.drawingMode;if(s.isBrushing&&n&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=n.pane||0,{wx:l,wy:g}=v(o,r,a,u);o.add_brush_point(l,g),o.set_crosshair(r,a),i.onDirty(),s.touchMoved=!0;return}if(n&&B(n.tool)&&n.pathStarted&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=n.pane||0,{wx:l,wy:g}=v(o,r,a,u);o.set_elliott_manual_cursor(l,g),o.set_crosshair(r,a),i.onDirty(),s.touchMoved=!0;return}if(n&&V(n.tool)&&n.pathStarted&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=n.pane||0,{wx:l,wy:g}=v(o,r,a,u);o.set_path_cursor(l,g),o.set_crosshair(r,a),i.onDirty(),s.touchMoved=!0;return}if(n&&n.step>0&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top;!s.touchMoved&&(Math.abs(r-s.touchStartX)>10||Math.abs(a-s.touchStartY)>10)&&(s.touchMoved=!0);let u=n.pane||0,{wx:l,wy:g}=v(o,r,a,u);D(o,n.tool,n,l,g,n.style,u),o.set_crosshair(r,a);let f=o.hit_zone(r,a);i.onDirty(),i.onCrosshairMove?.(r,a,f);return}if(n&&tt(n.tool)&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=o.hit_zone(r,a),l=X(u),{wx:g,wy:f}=v(o,r,a,l);D(o,n.tool,n,g,f,n.style,l),o.set_crosshair(r,a),i.onDirty(),i.onCrosshairMove?.(r,a,u);return}if(p.touches.length===2){s.velSamples=[];let r=p.touches[1].clientX-p.touches[0].clientX,a=p.touches[1].clientY-p.touches[0].clientY,u=Math.sqrt(r*r+a*a),l=s.lastTouchDist/u,g=(p.touches[0].clientX+p.touches[1].clientX)/2-e.left,f=(p.touches[0].clientY+p.touches[1].clientY)/2-e.top;s.dragZone===3?o.zoom_y(f,l):s.dragZone===2?o.zoom_x(g,l):(o.zoom(g,f,l),o.pan(g-s.lastX,f-s.lastY)),s.lastTouchDist=u,s.lastX=g,s.lastY=f,i.onDirty()}else if(p.touches.length===1&&s.isDragging){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=r-s.lastX,l=a-s.lastY;!s.touchMoved&&(Math.abs(r-s.touchStartX)>10||Math.abs(a-s.touchStartY)>10)&&(s.touchMoved=!0,s.isCrosshairMode||clearTimeout(s.longPressTimer),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null)),s.isCrosshairMode?(o.set_crosshair(r,a),i.onDirty(),i.onCrosshairMove?.(r,a,s.dragZone),i.onVrvpHover?.(r,a)):(s.lastX=r,s.lastY=a,s.recordVelocity(u,l),s.dragZone===2?o.pan_x(u):s.dragZone===3?o.pan_y(l):o.pan(u,l),i.onDirty())}},{passive:!1}),t.addEventListener("touchend",p=>{if(s.disposed)return;if(clearTimeout(s.longPressTimer),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isDraggingAnchor){s.isDraggingAnchor=!1,s.dragAnchorIdx=-1,o.hide_crosshair(),i.onDirty(),i.onCrosshairHide?.();return}if(s.isDraggingDrawing){if(s.isDraggingDrawing=!1,o.hide_crosshair(),i.onDirty(),i.onCrosshairHide?.(),!s.touchMoved){let n=o.get_selected_drawing();if(n>0){let r=t.getBoundingClientRect();i.onDrawingDblClick?.(n,s.touchStartX,s.touchStartY,s.touchStartX+r.left,s.touchStartY+r.top)}}return}if(s.isBrushing){s.isBrushing=!1,o.finish_brush(),s.finishDrawing(),i.onDirty(),i.onCrosshairHide?.();return}let e=s.drawingMode;if(e&&B(e.tool)&&e.pathStarted){let n=Date.now(),r=s.touchStartX-(s._pathLastTapX||0),a=s.touchStartY-(s._pathLastTapY||0),u=Math.sqrt(r*r+a*a);n-(s._pathLastTapTime||0)<350&&u<30?(o.finish_elliott_manual(),s.finishDrawing(),s._pathLastTapTime=0):(s._pathLastTapTime=n,s._pathLastTapX=s.touchStartX,s._pathLastTapY=s.touchStartY),s.isDragging=!1,s.lastTouchDist=0,i.onDirty();return}if(e&&V(e.tool)&&e.pathStarted){let n=Date.now(),r=s.touchStartX-(s._pathLastTapX||0),a=s.touchStartY-(s._pathLastTapY||0),u=Math.sqrt(r*r+a*a);n-(s._pathLastTapTime||0)<350&&u<30?(o.finish_path(),s.finishDrawing(),s._pathLastTapTime=0):(s._pathLastTapTime=n,s._pathLastTapX=s.touchStartX,s._pathLastTapY=s.touchStartY),s.isDragging=!1,s.lastTouchDist=0,i.onDirty();return}if(e&<(e.tool)){let n=e._stepAtTouchStart;if(e.step===1&&(n===1||s.touchMoved)){let r=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let u=a.clientX-r.left,l=a.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=v(o,u,l,g);e.x2=f,e.y2=d,e.step=2,o.clear_drawing_preview()}}else if(e.step===2&&(n===2||s.touchMoved)){let r=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let u=a.clientX-r.left,l=a.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=v(o,u,l,g),_=z[e.tool];_&&_.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),G(o,e.tool,e,f,d,e.style),s.finishDrawing()}}s.isDragging=!1,s.lastTouchDist=0,s.drawingMode||(o.hide_crosshair(),i.onCrosshairHide?.()),i.onDirty();return}if(e&&e.step===1&&at(e.tool)){if(e._stepAtTouchStart===1||s.touchMoved){let r=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let u=a.clientX-r.left,l=a.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=v(o,u,l,g);G(o,e.tool,e,f,d,e.style),s.finishDrawing()}}s.isDragging=!1,s.lastTouchDist=0,s.drawingMode||(o.hide_crosshair(),i.onCrosshairHide?.()),i.onDirty();return}if(e&&tt(e.tool)){let n=t.getBoundingClientRect(),r=p.changedTouches?.[0];if(r){let a=r.clientX-n.left,u=r.clientY-n.top,l=o.hit_zone(a,u),g=F(l)?X(l):e.pane||0,{wx:f,wy:d}=v(o,a,u,g),_=e.tool;o.clear_drawing_preview();let c=G(o,_,e,f,d,e.style);s.finishDrawing(),_==="textnote"&&c>0&&(o.select_drawing(c),i.onDrawingSelected?.(c),i.onDrawingDblClick?.(c,a,u,a+n.left,u+n.top))}s.isDragging=!1,s.lastTouchDist=0,o.hide_crosshair(),i.onCrosshairHide?.(),i.onDirty();return}if(!s.touchMoved&&!s.drawingMode&&s.isDragging){let n=Date.now(),r=s.touchStartX-s.lastTapX,a=s.touchStartY-s.lastTapY,u=Math.sqrt(r*r+a*a),l=n-s.lastTapTime<350&&u<30,g=o.hover_hit_test(s.touchStartX,s.touchStartY),f=g[0],d=g[1],_=g[3],c=g[4];if(F(f))if(_>0){o.deselect_marker(),i.onMarkerSelected?.(0),o.select_drawing(_);let h=t.getBoundingClientRect(),w=s.touchStartX+h.left,m=s.touchStartY+h.top;i.onDrawingSelected?.(_,w,m),(d<=0||d===_)&&i.onDrawingDblClick?.(_,s.touchStartX,s.touchStartY,w,m),i.onDirty()}else c>0?(o.deselect_drawing(),i.onDrawingSelected?.(0),o.select_marker(c),i.onMarkerSelected?.(c),i.onDirty()):(d>0&&(o.deselect_drawing(),i.onDrawingSelected?.(0),i.onDirty()),o.get_selected_marker()>0&&(o.deselect_marker(),i.onMarkerSelected?.(0),i.onDirty()));s.lastTapTime=n,s.lastTapX=s.touchStartX,s.lastTapY=s.touchStartY}s.touchMoved&&!s.isCrosshairMode&&!s.drawingMode&&s.startMomentum(s.dragZone),s.isDragging=!1,s.isCrosshairMode=!1,s.lastTouchDist=0,(!s.drawingMode||s.drawingMode.step===0)&&(o.hide_crosshair(),i.onCrosshairHide?.()),i.onDirty(),i.onVrvpHover?.(null,null)})}function yt(t,o,i){let s={disposed:!1,isDragging:!1,dragZone:0,lastX:0,lastY:0,lastTouchDist:0,isResizingRsi:!1,isResizingOi:!1,isResizingFr:!1,isResizingCvd:!1,resizeStartY:0,resizeStartRatio:0,lastClickTime:0,isDraggingAnchor:!1,dragAnchorIdx:-1,dragAnchorPane:0,isBrushing:!1,isDraggingDrawing:!1,dragDrawingPane:0,dragDrawingLastWx:0,dragDrawingLastWy:0,touchStartX:0,touchStartY:0,touchMoved:!1,longPressTimer:null,isCrosshairMode:!1,liqPinTimer:null,liqPinSx:0,liqPinSy:0,velSamples:[],momentumRaf:null,momentumVx:0,momentumVy:0,momentumZone:0,lastTapTime:0,lastTapX:0,lastTapY:0,drawingMode:null},p=.92,e=.5,n=80;s.recordVelocity=function(l,g){let f=performance.now();for(s.velSamples.push({dx:l,dy:g,t:f});s.velSamples.length>0&&f-s.velSamples[0].t>n;)s.velSamples.shift()};function r(){if(s.velSamples.length<2)return{vx:0,vy:0};let l=s.velSamples[0],f=s.velSamples[s.velSamples.length-1].t-l.t;if(f<5)return{vx:0,vy:0};let d=0,_=0;for(let h of s.velSamples)d+=h.dx,_+=h.dy;let c=16.67;return{vx:d/f*c,vy:_/f*c}}s.cancelMomentum=function(){s.momentumRaf&&(cancelAnimationFrame(s.momentumRaf),s.momentumRaf=null),s.velSamples=[]},s.startMomentum=function(l){let{vx:g,vy:f}=r();if(s.velSamples=[],Math.abs(g)<e&&Math.abs(f)<e)return;s.momentumVx=g,s.momentumVy=f,s.momentumZone=l;function d(){if(s.momentumVx*=p,s.momentumVy*=p,Math.abs(s.momentumVx)<e&&Math.abs(s.momentumVy)<e){s.momentumRaf=null;return}s.momentumZone===2?o.pan_x(s.momentumVx):s.momentumZone===3?o.pan_y(s.momentumVy):o.pan(s.momentumVx,s.momentumVy),i.onDirty(),s.momentumRaf=requestAnimationFrame(d)}s.momentumRaf=requestAnimationFrame(d)};let a={setMode(l,g){l?(s.drawingMode={tool:l,style:g,step:0,x1:0,y1:0},t.style.cursor="crosshair"):(s.drawingMode?.pathStarted&&o.finish_path(),s.drawingMode=null,o.clear_drawing_preview(),t.style.cursor="crosshair"),i.onDirty()},getMode(){return s.drawingMode}};i.drawingApi?.(a),s.finishDrawing=function(){o.clear_drawing_preview(),i.onDrawingComplete?.(),s.drawingMode=null,t.style.cursor="crosshair"},$t(t,o,i,s),Jt(t,o,i,s);let u=l=>{let g=document.activeElement?.tagName,f=g==="INPUT"||g==="TEXTAREA"||document.activeElement?.isContentEditable;if((l.key==="Delete"||l.key==="Backspace")&&!s.drawingMode&&!f){let _=o.get_selected_drawing();if(_>0){o.remove_drawing(_),i.onDrawingSelected?.(0),i.onDirty();return}let c=o.get_selected_marker();if(c>0){o.remove_marker(c),i.onMarkerSelected?.(0),i.onDirty();return}}if(l.key==="Escape"&&!s.drawingMode){if(o.get_selected_drawing()>0){o.deselect_drawing(),i.onDrawingSelected?.(0),i.onDirty();return}if(o.get_selected_marker()>0){o.deselect_marker(),i.onMarkerSelected?.(0),i.onDirty();return}}if(l.key==="Escape"&&s.drawingMode){if(s.drawingMode.pathStarted){s.drawingMode.tool==="elliott"?o.finish_elliott_manual():o.finish_path(),s.finishDrawing(),i.onDirty();return}o.clear_drawing_preview(),s.drawingMode=null,t.style.cursor="crosshair",i.onDrawingCancel?.(),i.onDirty();return}let d=20;switch(l.key){case"+":case"=":o.zoom(t.width/2,t.height/2,.9);break;case"-":o.zoom(t.width/2,t.height/2,1.1);break;case"ArrowLeft":o.pan_x(d);break;case"ArrowRight":o.pan_x(-d);break;case"ArrowUp":o.pan_y(-d);break;case"ArrowDown":o.pan_y(d);break;case"r":case"R":o.auto_scale_y();break;default:return}i.onDirty()};return window.addEventListener("keydown",u),()=>{s.disposed=!0,s.cancelMomentum(),window.removeEventListener("keydown",u)}}function te(t,o,i,s){let p=e=>s()(e);return{enableRsi(){t.enable_rsi(),o()},disableRsi(){t.disable_rsi(),o()},setRsiPeriod(e){t.set_rsi_period(e),o()},isRsiEnabled(){return t.is_rsi_enabled()},setRsiShowEma(e){t.set_rsi_show_ema(e),o()},setRsiShowWma(e){t.set_rsi_show_wma(e),o()},setRsiShowSignals(e){t.set_rsi_show_signals(e),o()},setRsiShowDivergence(e){t.set_rsi_show_divergence(e),o()},setRsiShowTraps(e){t.set_rsi_show_traps(e),o()},setRsiSmoothing(e){t.set_rsi_smoothing(e),o()},setRsiRatio(e){t.set_rsi_ratio(e),o()},getRsiRatio(){return t.get_rsi_ratio()},enableForexSignals(){p("forexSignals")&&(t.enable_forex_signals(),o())},disableForexSignals(){t.disable_forex_signals(),o()},isForexSignalsEnabled(){return t.is_forex_signals_enabled()},setForexSignalsSetup(e){t.set_forex_signals_setup(e),o()},setForexSignalsMode(e){t.set_forex_signals_mode(e),o()},setForexSignalsShowStats(e){t.set_forex_signals_show_stats(e),o()},getForexSignalsCount(){return t.get_forex_signals_count()},enableOi(){i()||p("oi")&&(t.enable_oi(),o())},disableOi(){i()||(t.disable_oi(),o())},isOiEnabled(){if(i())return!1;try{return t.is_oi_enabled()}catch{return!1}},setOiData(e){i()||(t.set_oi_data(e),o())},setOiDataTs(e,n){i()||(t.set_oi_data_ts(e,n),o())},setOiShowOnChart(e){i()||(t.set_oi_show_on_chart(e),o())},setOiDisplayMode(e){i()||(t.set_oi_display_mode(e),o())},setOiRatio(e){i()||(t.set_oi_ratio(e),o())},getOiRatio(){if(i())return .2;try{return t.get_oi_ratio()}catch{return .2}},enableFundingRate(){i()||p("fundingRate")&&(t.enable_funding_rate(),o())},disableFundingRate(){i()||(t.disable_funding_rate(),o())},isFundingRateEnabled(){if(i())return!1;try{return t.is_funding_rate_enabled()}catch{return!1}},setFrBinanceData(e,n){i()||(t.set_fr_binance_data(e,n),o())},setFrAggData(e,n){i()||(t.set_fr_agg_data(e,n),o())},setFrShowAgg(e){i()||(t.set_fr_show_agg(e),o())},setFrShowSma(e){i()||(t.set_fr_show_sma(e),o())},enableCvd(){i()||p("cvd")&&(t.enable_cvd(),o())},disableCvd(){i()||(t.disable_cvd(),o())},isCvdEnabled(){if(i())return!1;try{return t.is_cvd_enabled()}catch{return!1}},setCvdData(e,n){i()||(t.set_cvd_data(e,n),o())},setCvdMode(e){i()||(t.set_cvd_mode(e),o())},getCvdMode(){if(i())return 0;try{return t.get_cvd_mode()}catch{return 0}},setCvdShowDelta(e){i()||(t.set_cvd_show_delta(e),o())},getCvdShowDelta(){if(i())return!0;try{return t.get_cvd_show_delta()}catch{return!0}},enableLargeTrades(){i()||p("largeTrades")&&(t.enable_large_trades(),o())},disableLargeTrades(){i()||(t.disable_large_trades(),o())},isLargeTradesEnabled(){if(i())return!1;try{return t.is_large_trades_enabled()}catch{return!1}},setLargeTradesData(e){i()||(t.set_large_trades_data(e),o())},pushLargeTrade(e,n,r,a){i()||(t.push_large_trade(e,n,r,a),o())},clearLargeTrades(){i()||(t.clear_large_trades(),o())},setLtVolumeFilter(e,n){i()||(t.set_lt_volume_filter(e,n),o())},setLtBubbleScale(e){i()||(t.set_lt_bubble_scale(e),o())},getLtDataMinVol(){return i()?0:t.get_lt_data_min_vol()},getLtDataMaxVol(){return i()?0:t.get_lt_data_max_vol()},ltHitTest(e,n){if(i())return"";try{return t.lt_hit_test(e,n)}catch{return""}},enableVrvp(){i()||p("vrvp")&&(t.enable_vrvp(),o())},disableVrvp(){i()||(t.disable_vrvp(),o())},isVrvpEnabled(){if(i())return!1;try{return t.is_vrvp_enabled()}catch{return!1}},setVrvpPocLine(e){i()||(t.set_vrvp_poc_line(e),o())},vrvpHitTest(e,n){if(i())return"";try{return t.vrvp_hit_test(e,n)}catch{return""}},enableTpo(){i()||p("tpo")&&(t.enable_tpo(),o())},disableTpo(){i()||(t.disable_tpo(),o())},isTpoEnabled(){if(i())return!1;try{return t.is_tpo_enabled()}catch{return!1}},setTpoPocLine(e){i()||(t.set_tpo_poc_line(e),o())},setTpoVaLines(e){i()||(t.set_tpo_va_lines(e),o())},setTpoIb(e){i()||(t.set_tpo_ib(e),o())},setTpoSinglePrints(e){i()||(t.set_tpo_single_prints(e),o())},setTpoPeriod(e){i()||(t.set_tpo_period(e),o())},getTpoPeriod(){if(i())return 1440;try{return t.get_tpo_period()}catch{return 1440}},setTpoNakedPoc(e){i()||(t.set_tpo_naked_poc(e),o())},setTpoProfileShape(e){i()||(t.set_tpo_profile_shape(e),o())},setTpoIbMinutes(e){i()||(t.set_tpo_ib_minutes(e),o())},setTpoLetterMinutes(e){i()||(t.set_tpo_letter_minutes(e),o())},setTpoSignals(e){i()||(t.set_tpo_signals(e),o())},isTpoSignals(){if(i())return!1;try{return t.is_tpo_signals()}catch{return!1}},enableLiqHeatmap(){i()||p("liqHeatmap")&&(t.enable_liq_heatmap(),o())},disableLiqHeatmap(){i()||(t.disable_liq_heatmap(),o())},isLiqHeatmapEnabled(){if(i())return!1;try{return t.is_liq_heatmap_enabled()}catch{return!1}},setLiqHeatmapRange(e,n){i()||(t.set_liq_heatmap_range(e,n),o())},getLiqHeatmapMin(){if(i())return 0;try{return t.get_liq_heatmap_min()}catch{return 0}},getLiqHeatmapMax(){if(i())return 1;try{return t.get_liq_heatmap_max()}catch{return 1}},getLiqHeatmapSegMax(){if(i())return 0;try{return t.get_liq_heatmap_seg_max()}catch{return 0}},setLiqHeatmapProfile(e){i()||(t.set_liq_heatmap_profile(e),o())},isLiqHeatmapProfile(){if(i())return!0;try{return t.is_liq_heatmap_profile()}catch{return!0}},setLiqHeatmapCellHeight(e){i()||(t.set_liq_heatmap_cell_height(e),o())},getLiqHeatmapCellHeight(){if(i())return 1;try{return t.get_liq_heatmap_cell_height()}catch{return 1}},setLiqHeatmapPredictions(e){i()||(t.set_liq_heatmap_predictions(e),o())},setLiqHeatmapFilledPct(e){i()||(t.set_liq_heatmap_filled_pct(e),o())},getLiqHeatmapFilledPct(){if(i())return .85;try{return t.get_liq_heatmap_filled_pct()}catch{return .85}},liqHeatmapHitTest(e,n){if(i())return"";try{return t.liq_heatmap_hit_test(e,n)}catch{return""}},liqZoneHitTest(e,n){if(i())return"";try{return t.liq_zone_hit_test(e,n)}catch{return""}},enableSmartRanges(){i()||p("smartRanges")&&(t.enable_smart_ranges(),o())},disableSmartRanges(){i()||(t.disable_smart_ranges(),o())},isSmartRangesEnabled(){if(i())return!1;try{return t.is_smart_ranges_enabled()}catch{return!1}},setSrTextSize(e){i()||(t.set_sr_text_size(e),o())},setSrShowOb(e){i()||(t.set_sr_show_ob(e),o())},setSrObLast(e){i()||(t.set_sr_ob_last(e),o())},setSrShowObActivity(e){i()||(t.set_sr_show_ob_activity(e),o())},setSrShowBreakers(e){i()||(t.set_sr_show_breakers(e),o())},setSrMitigation(e){i()||(t.set_sr_mitigation(e),o())},setSrShowMetrics(e){i()||(t.set_sr_show_metrics(e),o())},setSrShowHtfOb(e){i()||(t.set_sr_show_htf_ob(e),o())},setSrHtfMinutes(e){i()||(t.set_sr_htf_minutes(e),o())},setSrShowFvg(e){i()||(t.set_sr_show_fvg(e),o())},setSrFvgTheme(e){i()||(t.set_sr_fvg_theme(e),o())},setSrFvgMitigation(e){i()||(t.set_sr_fvg_mitigation(e),o())},setSrFvgHtf(e){i()||(t.set_sr_fvg_htf(e),o())},setSrFvgExtend(e){i()||(t.set_sr_fvg_extend(e),o())},setSrShowObSignals(e){i()||(t.set_sr_show_ob_signals(e),o())},setSrShowPredict(e){i()||(t.set_sr_show_predict(e),o())},setSrShowFvgSignals(e){i()||(t.set_sr_show_fvg_signals(e),o())},setSrShowSmartRev(e){i()||(t.set_sr_show_smart_rev(e),o())},setSrSmartRevHtf(e){i()||(t.set_sr_smart_rev_htf(e),o())},setSrStatsType(e){i()||(t.set_sr_stats_type(e),o())},setSrStatsPosition(e){i()||(t.set_sr_stats_position(e),o())},getSrSignalsCount(){if(i())return 0;try{return t.get_sr_signals_count()}catch{return 0}},enableEmaStructure(){i()||p("emaStructure")&&(t.enable_ema_structure(),o())},disableEmaStructure(){i()||(t.disable_ema_structure(),o())},isEmaStructureEnabled(){if(i())return!1;try{return t.is_ema_structure_enabled()}catch{return!1}},setEsEma1Len(e){i()||(t.set_es_ema1_len(e),o())},setEsEma2Len(e){i()||(t.set_es_ema2_len(e),o())},setEsWmaLen(e){i()||(t.set_es_wma_len(e),o())},setEsShowEma1(e){i()||(t.set_es_show_ema1(e),o())},setEsShowEma2(e){i()||(t.set_es_show_ema2(e),o())},setEsShowWma(e){i()||(t.set_es_show_wma(e),o())},setEsSwingLen(e){i()||(t.set_es_swing_len(e),o())},setEsShowBos(e){i()||(t.set_es_show_bos(e),o())},enableLiveSignals(){i()||(t.enable_live_signals(),o())},disableLiveSignals(){i()||(t.disable_live_signals(),o())},isLiveSignalsEnabled(){if(i())return!1;try{return t.is_live_signals_enabled()}catch{return!1}},setLiveSignalsData(e){i()||(t.set_live_signals_data(new Float64Array(e)),o())},clearLiveSignals(){i()||(t.clear_live_signals(),o())},setLiveSignalsLeverage(e){i()||(t.set_live_signals_leverage(e),o())},getLiveSignalsLeverage(){if(i())return 10;try{return t.get_live_signals_leverage()}catch{return 10}},setLiveSignalsTrial(e){i()||(t.set_live_signals_trial(e),o())},setLiveSignalsShowEntry(e){i()||(t.set_live_signals_show_entry(e),o())},setLiveSignalsShowTpSl(e){i()||(t.set_live_signals_show_tp_sl(e),o())},setLiveSignalsShowMaxProfit(e){i()||(t.set_live_signals_show_max_profit(e),o())},setLiveSignalsShowLabels(e){i()||(t.set_live_signals_show_labels(e),o())},setLiveSignalsShowZones(e){i()||(t.set_live_signals_show_zones(e),o())},setLiveSignalsTextSize(e){i()||(t.set_live_signals_text_size(e),o())},setLiveSignalsPipValue(e){i()||(t.set_live_signals_pip_value(e),o())},setLiveSignalsLoading(e){i()||(t.set_live_signals_loading(e),o())},getLiveSignalsCount(){if(i())return 0;try{return t.get_live_signals_count()}catch{return 0}},enableVpin(){i()||p("vpin")&&(t.enable_vpin(),o())},disableVpin(){i()||(t.disable_vpin(),o())},isVpinEnabled(){if(i())return!1;try{return t.is_vpin_enabled()}catch{return!1}},setVpinData(e,n){i()||(t.set_vpin_data(e,n),o())},setVpinBucketSize(e){i()||(t.set_vpin_bucket_size(e),o())},getVpinBucketSize(){if(i())return 50;try{return t.get_vpin_bucket_size()}catch{return 50}},setVpinNumBuckets(e){i()||(t.set_vpin_num_buckets(e),o())},getVpinNumBuckets(){if(i())return 50;try{return t.get_vpin_num_buckets()}catch{return 50}},setVpinThreshold(e){i()||(t.set_vpin_threshold(e),o())},getVpinThreshold(){if(i())return .7;try{return t.get_vpin_threshold()}catch{return .7}},setVpinShowSma(e){i()||(t.set_vpin_show_sma(e),o())},setVpinShowZones(e){i()||(t.set_vpin_show_zones(e),o())},enableStopIceberg(){i()||p("stopIceberg")&&(t.enable_stop_iceberg(),o())},disableStopIceberg(){i()||(t.disable_stop_iceberg(),o())},isStopIcebergEnabled(){if(i())return!1;try{return t.is_stop_iceberg_enabled()}catch{return!1}},setSiShowStops(e){i()||(t.set_si_show_stops(e),o())},setSiShowIcebergs(e){i()||(t.set_si_show_icebergs(e),o())},setSiShowZones(e){i()||(t.set_si_show_zones(e),o())},setIcebergEvents(e,n,r,a,u,l){i()||(t.set_iceberg_events(e,n,r,a,u,l),o())},getStopRunCount(){if(i())return 0;try{return t.get_stop_run_count()}catch{return 0}},getIcebergCount(){if(i())return 0;try{return t.get_iceberg_count()}catch{return 0}},enableVolume(){t.enable_volume(),o()},disableVolume(){t.disable_volume(),o()},isVolumeEnabled(){return t.is_volume_enabled()},setVolumeMaPeriod(e){t.set_volume_ma_period(e),o()},setVolumeShowMa(e){t.set_volume_show_ma(e),o()},setVolumeShowSignals(e){t.set_volume_show_signals(e),o()},setVolumeColorMode(e){t.set_volume_color_mode(e),o()},getVolumeMaPeriod(){return t.get_volume_ma_period()},getVolumeShowMa(){return t.get_volume_show_ma()},getVolumeShowSignals(){return t.get_volume_show_signals()},getVolumeColorMode(){return t.get_volume_color_mode()}}}function ee(t,o,i,s){let p=e=>s()(e);return{addMarker(e,n,r){t.add_marker(e,n,r),o()},clearMarkers(){t.clear_markers(),o()},hitTestMarker(e,n){return t.hit_test_marker(e,n)},selectMarker(e){t.select_marker(e),o()},deselectMarker(){t.deselect_marker(),o()},getSelectedMarker(){return t.get_selected_marker()},removeMarker(e){t.remove_marker(e),o()},deleteSelectedMarker(){let e=t.get_selected_marker();return e>0&&(t.remove_marker(e),o()),e},addTrendline(e,n,r,a,u,l,g,f,d,_=0){let c=t.add_trendline(e,n,r,a,u,l,g,f,d,_);return o(),c},addHorizontalLine(e,n,r,a,u,l,g,f=0){let d=t.add_horizontal_line(e,n,r,a,u,l,g,f);return o(),d},addArrow(e,n,r,a,u,l,g,f,d,_=0){let c=t.add_arrow(e,n,r,a,u,l,g,f,d,_);return o(),c},addFibRetracement(e,n,r,a,u,l,g,f,d,_=0){if(!p("drawingFull"))return 0;let c=t.add_fib_retracement(e,n,r,a,u,l,g,f,d,_);return o(),c},addFibExtension(e,n,r,a,u,l,g,f,d,_,c,h=0){if(!p("drawingFull"))return 0;let w=t.add_fib_extension(e,n,r,a,u,l,g,f,d,_,c,h);return o(),w},addLongPosition(e,n,r,a,u,l,g,f,d,_=0){if(!p("drawingFull"))return 0;let c=t.add_long_position(e,n,r,a,u,l,g,f,d,_);return o(),c},addShortPosition(e,n,r,a,u,l,g,f,d,_=0){if(!p("drawingFull"))return 0;let c=t.add_short_position(e,n,r,a,u,l,g,f,d,_);return o(),c},addAnchoredVwap(e,n,r,a,u,l,g=0){if(!p("drawingFull"))return 0;let f=t.add_anchored_vwap(e,n,r,a,u,l,g);return o(),f},addPriceLabel(e,n,r,a,u,l,g=0){let f=t.add_price_label(e,n,r,a,u,l,g);return o(),f},addElliottImpulse(e,n,r,a,u,l,g=0){if(!p("drawingFull"))return 0;let f=t.add_elliott_impulse(e,n,r,a,u,l,g);return o(),f},setDrawingFontSize(e,n){t.set_drawing_font_size(e,n),o()},getDrawingFontSize(e){return t.get_drawing_font_size(e)},setDrawingText(e,n){t.set_drawing_text(e,n),o()},getDrawingText(e){return t.get_drawing_text(e)},setDrawingStyle(e,n,r,a,u){t.set_drawing_style(e,n,r,a,u),o()},getDrawingColor(e){let n=t.get_drawing_color(e);return n?{r:n>>>24&255,g:n>>>16&255,b:n>>>8&255,lineWidth:(n&255)/10}:null},getDrawingDashed(e){try{return t.get_drawing_dashed(e)}catch{return!1}},setDrawingDashed(e,n){t.set_drawing_dashed(e,n),o()},getDrawingHideLabel(e){try{return t.get_drawing_hide_label(e)}catch{return!1}},setDrawingHideLabel(e,n){t.set_drawing_hide_label(e,n),o()},getDrawingKindId(e){try{return t.get_drawing_kind_id(e)}catch{return 255}},removeDrawing(e){t.remove_drawing(e),o()},clearDrawings(){t.clear_drawings(),o()},drawingCount(){return t.drawing_count()},setDrawingPreview(e,n,r,a,u,l,g,f,d,_,c=0){t.set_drawing_preview(e,n,r,a,u,l,g,f,d,_,c),o()},clearDrawingPreview(){t.clear_drawing_preview(),o()},cancelBrush(){t.cancel_brush(),o()},selectDrawing(e){t.select_drawing(e),o()},deselectDrawing(){t.deselect_drawing(),o()},getSelectedDrawing(){return t.get_selected_drawing()},deleteSelectedDrawing(){let e=t.get_selected_drawing();return e>0&&(t.remove_drawing(e),o()),e},exportDrawingsJson(){try{return t.export_drawings_json()}catch{return"[]"}},importDrawingsJson(e){try{t.import_drawings_json(e),o()}catch(n){console.warn("[bridge] importDrawingsJson failed",n)}},screenToWorld(e,n){return{x:t.screen_to_world_x(e),y:t.screen_to_world_y(n)}},worldToScreen(e,n){try{return{x:t.world_to_screen_x(e),y:t.world_to_screen_y(n)}}catch{return null}}}}var y=t=>t instanceof Float64Array?t:new Float64Array(t);function re(t,o,i,s){let p=e=>s()(e);return{setKlines(e,n,r,a,u,l){t.set_klines(y(e),y(n),y(r),y(a),y(u),y(l)),o()},setRealTimestamps(e){t.set_real_timestamps(y(e)),o()},appendRealTimestamp(e){t.append_real_timestamp(e)},prependKlines(e,n,r,a,u,l){t.prepend_klines(y(e),y(n),y(r),y(a),y(u),y(l)),o()},appendKline(e,n,r,a,u,l){t.append_kline(e,n,r,a,u,l),o()},updateLastKline(e,n,r,a,u,l){t.update_last_kline(e,n,r,a,u,l),o()},popLastKline(){let e=t.pop_last_kline();return e&&o(),e},getLastClose(){try{return t.get_last_close()}catch{return 0}},getKlineCount(){if(i())return 0;try{return t.kline_count()}catch{return 0}},getKlineTimestamps(){if(i())return null;try{return t.kline_timestamps()}catch{return null}},getKlineOpens(){if(i())return null;try{return t.kline_opens()}catch{return null}},getKlineHighs(){if(i())return null;try{return t.kline_highs()}catch{return null}},getKlineLows(){if(i())return null;try{return t.kline_lows()}catch{return null}},getKlineCloses(){if(i())return null;try{return t.kline_closes()}catch{return null}},getKlineVolumes(){if(i())return null;try{return t.kline_volumes()}catch{return null}},setHeatmap(e,n,r,a,u,l,g){p("heatmap")&&(t.set_heatmap(y(e),n,r,a,u,l,g),o())},appendHeatmapColumn(e,n,r,a){p("heatmap")&&(t.append_heatmap_column(y(e),n,r,a),o())},updateLastHeatmapColumn(e,n,r){t.update_last_heatmap_column(y(e),n,r),o()},getHeatmapLastTimestamp(){try{return t.get_heatmap_last_timestamp()}catch{return 0}},getHeatmapXStep(){try{return t.get_heatmap_x_step()}catch{return 0}},updateHeatmapColumnAt(e,n,r,a){t.update_heatmap_column_at(y(e),n,r,a),o()},setHeatmapRange(e,n){t.set_heatmap_range(e,n),o()},getHeatmapDataRange(){try{return{min:t.get_heatmap_data_min(),max:t.get_heatmap_data_max()}}catch{return{min:0,max:0}}},setHeatmapPrefetchRange(e){try{t.set_heatmap_prefetch_range(e)}catch{}},clearHeatmapPrefetchRange(){try{t.clear_heatmap_prefetch_range()}catch{}},getHeatmapPrefetchMax(){try{return t.get_heatmap_prefetch_max()}catch{return 0}},setChartType(e){i()||e===2&&!p("footprint")||(t.set_chart_type(e),o())},getChartType(){if(i())return 0;try{return t.get_chart_type()}catch{return 0}},setFootprintTickSize(e){i()||p("footprint")&&(t.set_footprint_tick_size(e),o())},footprintEnsureLen(e){i()||t.footprint_ensure_len(e)},footprintAddTrade(e,n,r,a){i()||t.footprint_add_trade(e,n,r,a)},footprintAddTradeBatch(e){i()||!e||e.length===0||t.footprint_add_trade_batch(y(e))},footprintSetBar(e,n,r,a,u){i()||(t.footprint_set_bar(e,n,r,a,u),o())},footprintClear(){i()||(t.footprint_clear(),o())},footprintClearBar(e){i()||t.footprint_clear_bar(e)},footprintPrependEmpty(e){i()||t.footprint_prepend_empty(e)},footprintSetShowSignals(e){i()||(t.footprint_set_show_signals(e),o())},footprintGetShowSignals(){if(i())return!0;try{return t.footprint_get_show_signals()}catch{return!0}},footprintSignalCount(){if(i())return 0;try{return t.footprint_signal_count()}catch{return 0}},footprintSetShowProfile(e){i()||(t.footprint_set_show_profile(e),o())},footprintGetShowProfile(){if(i())return!1;try{return t.footprint_get_show_profile()}catch{return!1}},footprintProfileHitTest(e,n){if(i())return"";try{return t.footprint_profile_hit_test(e,n)}catch{return""}},footprintSetDisplayMode(e){i()||(t.footprint_set_display_mode(e),o())},footprintGetDisplayMode(){if(i())return 0;try{return t.footprint_get_display_mode()}catch{return 0}},enableDeltaHistogram(){i()||t.enable_delta_histogram()},disableDeltaHistogram(){i()||t.disable_delta_histogram()},deltaHistogramEnabled(){if(i())return!1;try{return t.delta_histogram_enabled()}catch{return!1}}}}var Pe=1;function j(t){if(typeof t!="string")return{r:255,g:255,b:255,a:153};if(t.startsWith("#")){let i=t.slice(1);if(i.length===8)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:parseInt(i.slice(6,8),16)};let s=parseInt(i.slice(0,2),16),p=parseInt(i.slice(2,4),16),e=parseInt(i.slice(4,6),16);return{r:s,g:p,b:e,a:255}}let o=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\)/);return o?{r:+o[1],g:+o[2],b:+o[3],a:o[4]!==void 0?Math.round(+o[4]*255):255}:{r:255,g:255,b:255,a:153}}function Nt(t,o,i){let s=new Map,p=null,e=0,n=NaN;function r(){let f;try{f=t.kline_count()}catch{return p}if(f===0)return null;let d=t.kline_closes(),_=d?.[f-1]??NaN;if(p&&!(f!==e||_!==n))return p;try{let h=t.kline_timestamps(),w=t.kline_opens(),m=t.kline_highs(),L=t.kline_lows(),S=t.kline_volumes();if(!h||!d)return p;p={timestamps:Array.from(h),open:Array.from(w),high:Array.from(m),low:Array.from(L),close:Array.from(d),volume:Array.from(S),length:f},e=f,n=_;for(let C of s.values())C._needsCompute=!0}catch{}return p}function a(){return{seriesLine(f,d="#ffffff99",_=1.5){let c=j(d);t.custom_series_line(new Float64Array(f),c.r,c.g,c.b,c.a,_)},seriesDashedLine(f,d="#ffffff66",_=1,c=4,h=4){let w=j(d);t.custom_series_dashed_line(new Float64Array(f),w.r,w.g,w.b,w.a,_,c,h)},band(f,d,_="rgba(100,149,237,0.08)"){let c=j(_);t.custom_band(new Float64Array(f),new Float64Array(d),c.r,c.g,c.b,c.a)},hline(f,d="#ffffff66",_=1){let c=j(d);t.custom_hline(f,c.r,c.g,c.b,c.a,_)},dashedHline(f,d="#ffffff66",_=1,c=6,h=4){let w=j(d);t.custom_dashed_hline(f,w.r,w.g,w.b,w.a,_,c,h)},marker(f,d,_="#e8a04a",c=3){let h=j(_);t.custom_marker(f,d,h.r,h.g,h.b,h.a,c)},markerUp(f,d,_="#26a69a",c=5){let h=j(_);t.custom_marker_up(f,d,h.r,h.g,h.b,h.a,c)},markerDown(f,d,_="#ef5350",c=5){let h=j(_);t.custom_marker_down(f,d,h.r,h.g,h.b,h.a,c)},text(f,d,_,c="#ffffffaa",h=10,w="center"){let m=j(c),L=w==="center"?1:w==="right"?2:0;t.custom_text(f,d,_,m.r,m.g,m.b,m.a,h,L)},priceLabel(f,d,_="#ffffffaa",c=10){let h=j(_);t.custom_price_label(f,d,h.r,h.g,h.b,h.a,c)},linePx(f,d,_,c,h,w=1){let m=j(h);t.custom_line_px(f,d,_,c,m.r,m.g,m.b,m.a,w)},fillRectPx(f,d,_,c,h){let w=j(h);t.custom_fill_rect_px(f,d,_,c,w.r,w.g,w.b,w.a)},strokeRectPx(f,d,_,c,h,w=1){let m=j(h);t.custom_stroke_rect_px(f,d,_,c,m.r,m.g,m.b,m.a,w)},textPx(f,d,_,c,h=10,w="left"){let m=j(c),L=w==="center"?1:w==="right"?2:0;t.custom_text_px(f,d,_,m.r,m.g,m.b,m.a,h,L)},worldToScreenX:f=>t.world_to_screen_x(f),worldToScreenY:f=>t.world_to_screen_y(f),screenToWorldX:f=>t.screen_to_world_x(f),screenToWorldY:f=>t.screen_to_world_y(f),chartArea:()=>({x:t.chart_area_x(),y:t.chart_area_y(),w:t.chart_area_w(),h:t.chart_area_h()})}}function u(f){if(!f.compute)return;let d=r();if(d)try{f._computed=f.compute(d,f.params)||{}}catch(_){console.warn(`[CustomIndicator "${f.name}"] compute error:`,_),f._computed={}}}function l(f){if(s.size===0)return;let d=r();if(!d)return;t.custom_begin();let _=a();for(let h of s.values())if(h.enabled){h._needsCompute&&(u(h),h._needsCompute=!1);try{h.render.call(h,_,h._computed||{},d)}catch(w){console.warn(`[CustomIndicator "${h.name}"] render error:`,w)}}if(t.custom_end(),t.custom_command_count()>0){let h=t.get_custom_buffer_ptr(),w=t.get_custom_buffer_len();i(f,o,h,w)}}function g(){p=null,e=0,n=NaN;for(let f of s.values())f._needsCompute=!0}return{add(f){let d=Pe++,_={id:d,name:f.name||`Custom ${d}`,params:{...f.params},compute:f.compute||null,render:f.render,enabled:!0,_computed:{},_needsCompute:!0};return s.set(d,_),d},remove(f){s.delete(f)},updateParams(f,d){let _=s.get(f);_&&(Object.assign(_.params,d),_._needsCompute=!0)},setEnabled(f,d){let _=s.get(f);_&&(_.enabled=d)},list(){return[...s.values()].map(f=>({id:f.id,name:f.name,params:{...f.params},enabled:f.enabled}))},invalidateCompute:g,renderAll:l}}var oe={trial:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!0,tpo:!0,smartRanges:!0,emaStructure:!0,customIndicators:!0,forexSignals:!0,vpin:!0,stopIceberg:!0},standard:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!1,heatmap:!1,footprint:!1,liqHeatmap:!1,oi:!1,fundingRate:!1,cvd:!1,largeTrades:!1,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1,vpin:!1,stopIceberg:!1},professional:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1,vpin:!1,stopIceberg:!1},enterprise:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!0,tpo:!0,smartRanges:!0,emaStructure:!0,customIndicators:!0,forexSignals:!0,vpin:!0,stopIceberg:!0}},Re={rsi:"RSI",drawingBasic:"Basic Drawing Tools",heatmap:"Orderbook Heatmap",footprint:"Footprint Chart",liqHeatmap:"Liquidation Heatmap",oi:"Open Interest",fundingRate:"Funding Rate",cvd:"CVD",largeTrades:"Large Trades",vrvp:"VRVP",tpo:"TPO / Market Profile",smartRanges:"Smart Ranges",emaStructure:"EMA Structure",drawingFull:"All Drawing Tools",customIndicators:"Custom Indicators",forexSignals:"Forex Signals",vpin:"VPIN",stopIceberg:"Stops & Icebergs"},je={rsi:"Standard",drawingBasic:"Standard",heatmap:"Professional",footprint:"Professional",liqHeatmap:"Professional",oi:"Professional",fundingRate:"Professional",cvd:"Professional",largeTrades:"Professional",drawingFull:"Professional",vrvp:"Enterprise",tpo:"Enterprise",smartRanges:"Enterprise",emaStructure:"Enterprise",customIndicators:"Enterprise",forexSignals:"Enterprise",vpin:"Enterprise",stopIceberg:"Enterprise"};function et(t){return oe[t]||oe.trial}function Pt(t){let o=et(t),i=new Set;return function(p){if(o[p])return!0;if(!i.has(p)){i.add(p);let e=Re[p]||p,n=je[p]||"a higher";console.warn(`[MRD Chart Engine] "${e}" requires ${n} plan. Current plan: ${t}. Upgrade at https://mrd-chart.dev/pricing`)}return!1}}var Fe=14,se="trial",ut="free";var jt=[95,95,109,114].map(t=>String.fromCharCode(t)).join(""),Ye=1297237059;function le(t){let o=`${t}:${Ye}:${(t^2043453)>>>0}`,i=2166136261;for(let s=0;s<o.length;s++)i^=o.charCodeAt(s),i=Math.imul(i,16777619);return(i>>>0).toString(36)}function ft(t){return`${t}.${le(t)}`}function dt(t){if(!t||typeof t!="string")return null;let o=t.lastIndexOf(".");if(o<1)return null;let i=parseInt(t.slice(0,o),10);return!i||i<1e9||i>2e9||t.slice(o+1)!==le(i)?null:i}var ue=jt+"e7x",fe=jt+"p3q",de="mrd_engine_session_id",_e="mrd_ce_db",rt="meta",ce="trial_ts",he=jt+"ck";function Ft(){try{return dt(localStorage.getItem(ue))}catch{return null}}function Yt(t){try{localStorage.setItem(ue,ft(t))}catch{}}function zt(){try{return dt(localStorage.getItem(fe))}catch{return null}}function Dt(t){try{localStorage.setItem(fe,ft(t))}catch{}}function Zt(){try{return dt(sessionStorage.getItem(de))}catch{return null}}function Xt(t){try{sessionStorage.setItem(de,ft(t))}catch{}}function Ht(){try{let t=document.cookie.match(new RegExp(`(?:^|;\\s*)${he}=([^;]+)`));return t?dt(decodeURIComponent(t[1])):null}catch{return null}}function Ot(t){try{let o=encodeURIComponent(ft(t));document.cookie=`${he}=${o};path=/;max-age=${86400*400};SameSite=Lax`}catch{}}var ot=null,ie=!1;function ze(){if(!(ie||typeof indexedDB>"u")){ie=!0;try{let t=indexedDB.open(_e,1);t.onupgradeneeded=()=>{let o=t.result;o.objectStoreNames.contains(rt)||o.createObjectStore(rt)},t.onsuccess=()=>{let s=t.result.transaction(rt,"readonly").objectStore(rt).get(ce);s.onsuccess=()=>{let p=dt(s.result);p&&(!ot||p<ot)&&(ot=p,De(p))}}}catch{}}}function pe(t){ot=t;try{let o=indexedDB.open(_e,1);o.onsuccess=()=>{o.result.transaction(rt,"readwrite").objectStore(rt).put(ft(t),ce)}}catch{}}function De(t){let o=Math.floor(Date.now()/1e3),i=we([Ft(),zt(),Zt(),Ht(),t],o);i&&i!==t||i&&(Yt(i),Dt(i),Xt(i),Ot(i))}function we(t,o){let i=null;for(let s of t)s&&(s>o+60||s<17e8||(!i||s<i)&&(i=s));return i}function Ze(){let t=Math.floor(Date.now()/1e3),o=[Ft(),zt(),Zt(),Ht(),ot];return we(o,t)}function Xe(t){Yt(t),Dt(t),Xt(t),Ot(t),pe(t)}function He(t){Ft()||Yt(t),zt()||Dt(t),Zt()||Xt(t),Ht()||Ot(t),ot||pe(t)}ze();function Mt(t){if(!t||t==="trial")return Oe();try{let o=JSON.parse(atob(t)),{p:i,d:s,e:p,s:e}=o;if(!i||!e)return{valid:!1,error:"Invalid license key format"};let n={...o};if(delete n.s,e!==ge(n))return{valid:!1,error:"Invalid license key signature"};if(p>0&&Date.now()/1e3>p)return{valid:!0,plan:ut,watermark:!0,trialExpired:!0,originalPlan:i,error:`License expired on ${new Date(p*1e3).toLocaleDateString()}`,features:et(ut)};let r=o.pl||"web";if((r==="web"||r==="any")&&s&&s!=="*"&&typeof window<"u"){let a=window.location.hostname;if(a&&a!=="localhost"&&a!=="127.0.0.1"&&a!=="0.0.0.0"&&a!==""&&!s.split(",").map(g=>g.trim()).some(g=>We(g,a)))return{valid:!1,error:`License not valid for domain: ${a}`}}if(r==="mobile"&&o.a&&typeof window<"u"){let a=window.__mrd_app_id;if(a&&a!==o.a)return{valid:!1,error:`License not valid for app: ${a}`}}return{valid:!0,plan:i,domain:s,platform:r,appId:o.a||null,expiry:p,watermark:!1,features:et(i)}}catch{return{valid:!1,error:"Invalid license key"}}}function ge(t){let o="mrd-ce-hmac-2024-x9k2m",i=JSON.stringify(t),s=o+":"+i,p=2166136261,e=1818371886,n=3735928559;for(let r=0;r<s.length;r++){let a=s.charCodeAt(r);p=Math.imul(p^a,16777619)>>>0,e=Math.imul(e^a,1540483477)>>>0,n=Math.imul(n^a,461845907)>>>0}return(p.toString(36)+e.toString(36)+n.toString(36)).slice(0,24)}function Oe(){let t=Ze();t?He(t):(t=Math.floor(Date.now()/1e3),Xe(t));let o=t+Fe*86400,i=Date.now()/1e3,s=Math.max(0,Math.ceil((o-i)/86400));return i>o?{valid:!0,plan:ut,watermark:!0,trialExpired:!0,daysLeft:0,features:et(ut)}:{valid:!0,plan:se,watermark:!1,daysLeft:s,trialEnd:o,features:et(se)}}function We(t,o){if(t==="*"||t===o)return!0;if(t.startsWith("*.")){let i=t.slice(1);return o.endsWith(i)||o===t.slice(2)}return!1}var Ve="MRD-Indicators",ne="mrd-indicators.com",Be="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCAzMCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNCk7CiAgICAgIH0KCiAgICAgIC5jbHMtMiB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtMik7CiAgICAgIH0KCiAgICAgIC5jbHMtMiwgLmNscy0zLCAuY2xzLTQsIC5jbHMtNSwgLmNscy02IHsKICAgICAgICBtaXgtYmxlbmQtbW9kZTogbXVsdGlwbHk7CiAgICAgIH0KCiAgICAgIC5jbHMtMyB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtMyk7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNik7CiAgICAgIH0KCiAgICAgIC5jbHMtNSB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNSk7CiAgICAgIH0KCiAgICAgIC5jbHMtNiB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNyk7CiAgICAgIH0KCiAgICAgIC5jbHMtNyB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQpOwogICAgICB9CgogICAgICAuY2xzLTggewogICAgICAgIGlzb2xhdGlvbjogaXNvbGF0ZTsKICAgICAgfQogICAgPC9zdHlsZT4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50IiB4MT0iOS4xMiIgeTE9IjE1Ljg4IiB4Mj0iMTkuNjMiIHkyPSI1LjM3IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2IzNTA5ZSIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmNWE0YzciLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC0yIiB4MT0iOS4wOCIgeTE9IjYuODEiIHgyPSI5LjA4IiB5Mj0iMTQuNzMiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjMjM0ZmIzIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2ZmZiIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTMiIHgxPSIxNy42NyIgeTE9IjYuMTEiIHgyPSI4LjQxIiB5Mj0iNi4xMSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM1YTJhOGIiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZmIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNCIgeDE9IjIwLjAzIiB5MT0iMTUuODkiIHgyPSIxMC45OCIgeTI9IjE1Ljg5IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2Y2YWFjYiIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM3NzJhOGQiLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC01IiB4MT0iMTkuMDMiIHkxPSIxNi44MiIgeDI9IjE0Ljc5IiB5Mj0iMTIuNTgiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2VkMzQ4ZCIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTYiIHgxPSIxNS4yNyIgeTE9IjE1LjA2IiB4Mj0iMTUuMjciIHkyPSIxOS4zNyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmYiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZWU0YzliIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNyIgeDE9IjUuNTEiIHkxPSItMTI4LjAyIiB4Mj0iLTMuNyIgeTI9Ii0xMjguMDIiIGdyYWRpZW50VHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEwOS4xMiAxMC4wMSkgcm90YXRlKDg5LjYpIiB4bGluazpocmVmPSIjbGluZWFyLWdyYWRpZW50LTMiLz4KICA8L2RlZnM+CiAgPGcgY2xhc3M9ImNscy04IiBpZD0iTG9nbyI+CiAgICA8ZyBpZD0iT0JKRUNUUyIgPgogICAgICA8ZyBpZCA9IkxvZ28iPiAKICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTciIGQ9Ik00LjIzLDExYzAsNS4zNiw0LjM3LDkuNzEsOS43Niw5LjcxczkuNzYtNC4zNSw5Ljc2LTkuNzFTMTkuMzksMS4yOSwxNCwxLjI5LDQuMjMsNS42NCw0LjIzLDExWk0xMC4yNiwxMC4wN2MwLTEuNTQsMS4yNS0yLjc4LDIuOC0yLjc4aDEuODdjMS41NSwwLDIuOCwxLjI1LDIuOCwyLjc4djEuODZjMCwxLjU0LTEuMjUsMi43OC0yLjgsMi43OGgtMS4yMmMtLjQ1LDAtLjg4LjE1LTEuMjIuNDRsLTIuMjMsMS44NHYtNi45MloiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik0xMC4yNiwxNi45OXYtNi45MnMwLS4wMiwwLS4wM2MuMDItMS41MiwxLjI2LTIuNzUsMi44LTIuNzVoLTUuMDljLTIuMDUsMC0zLjczLDEuNjQtMy43NCwzLjY4LDAsLjAxLDAsLjAzLDAsLjA0LDAsLjA4LDAsLjE2LDAsLjI0LDAsLjA0LDAsLjA4LDAsLjEyLDAsLjA0LDAsLjA4LDAsLjEyLDAsLjA2LDAsLjExLjAxLjE3LDAsLjAyLDAsLjA1LDAsLjA3LDAsLjA2LjAxLjEzLjAyLjE5LDAsLjAxLDAsLjAzLDAsLjA0LDAsLjA3LjAxLjE0LjAyLjIxLDAsMCwwLC4wMSwwLC4wMiwwLC4wNy4wMi4xNS4wMy4yMiwwLDAsMCwwLDAsMCwuNjgsNC42OCw0LjcxLDguMjcsOS42LDguMy0yLjA0LS4wMi0zLjY3LTEuNjktMy42Ny0zLjcyWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTE0LjA0LDEuMjlzLS4wMywwLS4wNCwwYy0uMDgsMC0uMTYsMC0uMjQsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDYsMC0uMTEsMC0uMTcsMC0uMDIsMC0uMDUsMC0uMDcsMC0uMDYsMC0uMTMuMDEtLjE5LjAyLS4wMSwwLS4wMywwLS4wNCwwLS4wNywwLS4xNC4wMS0uMjEuMDIsMCwwLS4wMSwwLS4wMiwwLS4wNywwLS4xNS4wMi0uMjIuMDMsMCwwLDAsMCwwLDAtNC43LjY4LTguMzIsNC42OS04LjM1LDkuNTQuMDItMi4wMiwxLjctMy42NSwzLjc0LTMuNjVoNi45NnMuMDIsMCwuMDMsMGMxLjUzLjAyLDIuNzcsMS4yNiwyLjc3LDIuNzh2LTUuMDZjMC0yLjA0LTEuNjUtMy43MS0zLjctMy43MloiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNC45MywxNC43MWg1LjA5YzIuMDQsMCwzLjcyLTEuNjMsMy43NC0zLjY1LS4wMyw0Ljg2LTMuNjUsOC44Ny04LjM1LDkuNTQsMCwwLDAsMCwwLDAtLjA3LjAxLS4xNS4wMi0uMjIuMDMsMCwwLS4wMSwwLS4wMiwwLS4wNywwLS4xNC4wMi0uMjEuMDItLjAxLDAtLjAzLDAtLjA0LDAtLjA2LDAtLjEzLjAxLS4xOS4wMi0uMDIsMC0uMDUsMC0uMDcsMC0uMDYsMC0uMTEsMC0uMTcsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDgsMC0uMTYsMC0uMjQsMC0uMDEsMC0uMDMsMC0uMDQsMC0yLjA1LDAtMy43LTEuNjgtMy43LTMuNzJsMi4yMy0xLjg0Yy4zNC0uMjguNzgtLjQ0LDEuMjItLjQ0aDEuMjJaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy01IiBkPSJNMTQuOTMsMTQuNzFoNS4wOWMyLjA0LDAsMy43Mi0xLjYzLDMuNzQtMy42NS0uMDMsNC44Ni0zLjY1LDguODctOC4zNSw5LjU0LDAsMCwwLDAsMCwwLS4wNy4wMS0uMTUuMDItLjIyLjAzLDAsMC0uMDEsMC0uMDIsMC0uMDcsMC0uMTQuMDItLjIxLjAyLS4wMSwwLS4wMywwLS4wNCwwLS4wNiwwLS4xMy4wMS0uMTkuMDItLjAyLDAtLjA1LDAtLjA3LDAtLjA2LDAtLjExLDAtLjE3LDAtLjA0LDAtLjA4LDAtLjEyLDAtLjA0LDAtLjA4LDAtLjEyLDAtLjA4LDAtLjE2LDAtLjI0LDAtLjAxLDAtLjAzLDAtLjA0LDAtMi4wNSwwLTMuNy0xLjY4LTMuNy0zLjcybDIuMjMtMS44NGMuMzQtLjI4Ljc4LS40NCwxLjIyLS40NGgxLjIyWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtNCIgZD0iTTIwLjI4LDE0LjcxYy0uMDgsMC0uMTcsMC0uMjUsMGgtNi4zMWMtLjQ1LDAtLjg4LjE1LTEuMjIuNDRsLTIuMjMsMS44NGMwLC4wOCwwLC4xNywwLC4yNSwxLjA5LjY1LDIuMzcsMS4wMiwzLjczLDEuMDIsMi42NywwLDUuMDEtMS40Myw2LjI4LTMuNTVaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy02IiBkPSJNMjMuNzcsMTAuOTdzMC0uMDMsMC0uMDRjMC0uMDgsMC0uMTYsMC0uMjQsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDYsMC0uMTEtLjAxLS4xNywwLS4wMiwwLS4wNSwwLS4wNywwLS4wNi0uMDEtLjEzLS4wMi0uMTksMC0uMDEsMC0uMDMsMC0uMDQsMC0uMDctLjAyLS4xNC0uMDItLjIxLDAsMCwwLS4wMSwwLS4wMiwwLS4wNy0uMDItLjE1LS4wMy0uMjIsMCwwLDAsMCwwLDAtLjcxLTQuNjctNC43Ny04LjI0LTkuNjYtOC4yNCwyLjA0LDAsMy42OCwxLjY2LDMuNywzLjY5bC4wNCw1LjA2djEuODZzLjAxLjAyLjAxLjAzYzAsMS41Mi0xLjI1LDIuNzYtMi43OCwyLjc3bDUuMDktLjA0YzIuMDUtLjAxLDMuNzItMS42NiwzLjcxLTMuN1oiLz4KICAgICAgPC9nPgogICAgPC9nPgogIDwvZz4KPC9zdmc+",Rt=null,ae=!1;function me(){if(Rt||ae)return Rt;ae=!0;let t=new Image;return t.onload=()=>{Rt=t},t.src=Be,null}function Ge(){return Math.floor(Date.now()/864e5)}function qe(t){let o=(t^2654435769)>>>0;return function(){o=o+1831565813>>>0;let i=Math.imul(o^o>>>15,1|o);return i=i+Math.imul(i^i>>>7,61|i)^i,((i^i>>>14)>>>0)/4294967296}}function Ke(t,o,i,s,p,e){let n=me();t.save(),t.setTransform(1,0,0,1,0,0),t.font="bold 10px Inter, system-ui, sans-serif";let r=t.measureText(s);t.font="8px Inter, system-ui, sans-serif";let a=t.measureText(p),u=n?18:0,l=n?14:0,g=7,f=5,d=n?5:0,c=u+d+Math.max(r.width,a.width)+g*2,h=Math.max(l,20)+f*2,w=Math.round(o-c/2),m=Math.round(i-h/2);t.globalAlpha=.45,t.fillStyle=e?"rgba(255,255,255,0.8)":"rgba(18,18,28,0.8)",t.shadowColor=e?"rgba(0,0,0,0.06)":"rgba(0,0,0,0.25)",t.shadowBlur=8,t.shadowOffsetY=1,t.beginPath(),t.roundRect(w,m,c,h,6),t.fill(),t.shadowColor="transparent",t.strokeStyle=e?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.04)",t.lineWidth=.5,t.stroke();let L=w+g,S=m+h/2;n&&(t.globalAlpha=.5,t.drawImage(n,L,S-l/2,u,l),L+=u+d),t.globalAlpha=.5,t.font="bold 10px Inter, system-ui, sans-serif",t.fillStyle=e?"#1a1a2e":"#ededf5",t.textAlign="left",t.textBaseline="alphabetic",t.fillText(s,L,S-1),t.font="8px Inter, system-ui, sans-serif",t.fillStyle=e?"#777790":"#8080a0",t.textBaseline="top",t.fillText(p,L,S+2),t.restore()}function Me(t,o,i,s){me();let p=o.width,e=o.height;if(p<100||e<80)return;t.save(),t.setTransform(1,0,0,1,0,0);let n=qe(Ge()),r=100,a=Math.max(p-r*2,60),u=Math.max(e-r*2,40),l=r+n()*a,g=r+n()*u,f=i.trialExpired||i.plan===ut,d=Ve,_=f?`Free \u2014 ${ne}/pricing`:`Trial: ${i.daysLeft||0}d left \u2014 ${ne}`;Ke(t,l,g,d,_,s),t.restore()}function Ue({plan:t,domain:o="*",expiryDays:i=365,name:s,email:p}){let e=i>0?Math.floor(Date.now()/1e3)+i*86400:0,n={p:t,d:o,e,...s?{n:s}:{},...p?{m:p}:{},i:Date.now()};return n.s=ge(n),btoa(JSON.stringify(n))}var Lt=null,St=null,_t=null;async function Le(){return Lt||_t||(_t=(async()=>{let t=await import("./chart_engine.js");return await t.default(),St=t.wasm_memory(),Lt=t,t})(),_t)}function Qe(){!Lt&&!_t&&Le().catch(()=>{})}async function xe(t,o={}){o.appId&&typeof window<"u"&&(window.__mrd_app_id=o.appId);let i=o.licenseKey||o.key||null,s=Mt(i);if(!s.valid)if(s.expired)console.warn(`[MRD Chart Engine] ${s.error}. Get a license at https://mrd-chart.dev/pricing`);else throw new Error(`[MRD Chart Engine] ${s.error}`);s.plan==="trial"&&console.info(`[MRD Chart Engine] Trial mode \u2014 ${s.daysLeft} days remaining. Purchase: https://mrd-chart.dev/pricing`);let p=await Le(),e=window.devicePixelRatio||1,n=t.getBoundingClientRect();(n.width<1||n.height<1)&&(await new Promise(M=>{let I=new ResizeObserver(A=>{for(let b of A)if(b.contentRect.width>0&&b.contentRect.height>0){I.disconnect(),M();return}});I.observe(t.parentElement||t),setTimeout(()=>{I.disconnect(),M()},2e3)}),n=t.getBoundingClientRect());let r=Math.max(n.width,100),a=Math.max(n.height,100);t.width=r*e,t.height=a*e;let u=t.getContext("2d");u.scale(e,e);let l=new p.ChartEngine(r,a);try{let M=s.expired?2:s.watermark?1:0,I=s.daysLeft||0,A=1297237059;A=Math.imul(A,31)+M>>>0,A=Math.imul(A,31)+I>>>0,A=(A^A>>>16)>>>0,A=Math.imul(A,73244475)>>>0,A=(A^A>>>16)>>>0,l.set_license_state(M,I,A)}catch(M){console.warn("[MRD] set_license_state failed:",M.message)}let g=!0,f=null,d=!1,_=!1,c=!1,h=null,w=null,m=0,L=!1,S=!1,N=("ontouchstart"in window||navigator.maxTouchPoints>0)&&window.innerWidth<=1399?33:0;function U(){if(!(!d||_||f)){if(N>0){let M=performance.now()-m;if(M<N){w||(w=setTimeout(()=>{w=null,U()},N-M));return}}f=requestAnimationFrame(Ce)}}let T=()=>{g=!0,U()},x=()=>c,$=null,ct=null,It=null,E=null,Z=null,W=null,H=null,O=null,st=0,J=null,Wt=null,Ct=0,At=0,k=-1,ht=!1,pt=!1,Se=yt(t,l,{onDirty:T,onCrosshairMove:(M,I,A)=>{Ct=M,At=I,k=A,ht=!0,pt=!0},onCrosshairHide:()=>{pt&&(pt=!1,ht=!0,k=-1)},drawingApi:M=>{$=M},onDrawingComplete:()=>{ct?.()},onDrawingCancel:()=>{It?.()},onDrawingSelected:(M,I,A)=>{E?.(M,I,A)},onMarkerSelected:M=>{Z?.(M)},onDrawingDblClick:(M,I,A,b,vt)=>{W?.(M,I,A,b,vt)},onVrvpHover:(M,I)=>{H?.(M,I)},onLiqAnnotationPin:(M,I)=>{Wt?.(M,I)}});function Ie(){if(!(!ht||S)){if(ht=!1,!pt){h&&h(null,0,0),O&&O("");return}if(h)if(k===0||k===1)try{let M=l.get_tooltip_data();h(M,Ct,At)}catch{}else h(null,0,0);if(O){let M=performance.now();if(k===0||k===1){if(M-st>=80){st=M;try{O(l.lt_hit_test(Ct,At))}catch{}}}else O("")}}}function Ce(){if(f=null,!(!d||_||S)){L=!0;try{let M=!1;try{M=g||l.is_dirty()}catch{S=!0;return}if(M){g=!1,m=performance.now();let I=!1;try{if(l.render()>0){let b=l.get_command_buffer_ptr(),vt=l.get_command_buffer_len();u.save(),u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,t.width,t.height),u.restore(),nt(u,St,b,vt),I=!0}try{Q.renderAll(u)}catch{}}catch(A){if(I||(g=!0),A instanceof WebAssembly.RuntimeError){S=!0,console.error("[MRD] Engine crashed:",A.message);return}}Ie();try{J?.()}catch{}if(s.watermark)try{let A=l.get_theme()===1;Me(u,t,s,A)}catch{}try{(g||l.is_dirty())&&U()}catch{}}}finally{L=!1}}}let it=Pt(s.plan),Ae=te(l,T,x,()=>it),ve=ee(l,T,x,()=>it),be=re(l,T,x,()=>it),Q=Nt(l,St,nt);return{engine:l,start(){d=!0,_=!1,g=!0,U()},stop(){d=!1,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null)},resize(M){if(S||L)return;if(n=t.getBoundingClientRect(),n.width<1||n.height<1){(M||0)<8&&setTimeout(()=>this.resize((M||0)+1),250);return}e=window.devicePixelRatio||1;let I=n.width*e,A=n.height*e;t.width=I,t.height=A,u.setTransform(1,0,0,1,0,0),u.scale(e,e);try{l.resize(n.width,n.height)}catch(b){if(b instanceof WebAssembly.RuntimeError){S=!0;return}throw b}T()},renderSync(){if(S)return 0;try{let M=l.render();if(M>0){let I=l.get_command_buffer_ptr(),A=l.get_command_buffer_len();u.save(),u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,t.width,t.height),u.restore(),nt(u,St,I,A)}return M}catch(M){return M instanceof WebAssembly.RuntimeError&&(S=!0),0}},setHoverPrice(M){l.set_hover_price(M),T()},clearHoverPrice(){l.clear_hover_price(),T()},hitZone(M,I){return l.hit_zone(M,I)},startDrawing(M,I){$?.setMode(M,I)},cancelDrawing(){$?.setMode(null)},onDrawingComplete(M){ct=M},onDrawingCancel(M){It=M},onDrawingSelected(M){E=M},onMarkerSelected(M){Z=M},onDrawingDblClick(M){W=M},setReplayState(M,I,A){l.set_replay_state(M,I,A),T()},setReplayHovered(M){l.set_replay_hovered(M)},setReplayPreview(M){l.set_replay_preview(M),T()},setPrecision(M){l.set_price_precision(M),T()},setCandleInterval(M){l.set_candle_interval(M)},setTheme(M){let I=M==="light"?1:0;typeof l.set_theme=="function"?(l.set_theme(I),T()):console.warn("[ChartEngine] set_theme not available \u2014 reload page to load updated WASM")},getTheme(){return l.get_theme()===1?"light":"dark"},onTooltip(M){h=M},onVrvpHover(M){H=M},onLtHover(M){O=M},onPostRender(M){J=M},onLiqAnnotationPin(M){Wt=M},pause(){_||(_=!0,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null))},resume(){_&&(_=!1,d&&(g=!0,U()))},get isPaused(){return _},destroy(){c=!0,d=!1,_=!1,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null),Se();try{l.free()}catch{}},addIndicator(M){if(!it("customIndicators"))return null;let I=Q.add(M);return T(),I},removeIndicator(M){Q.remove(M),T()},updateIndicatorParams(M,I){Q.updateParams(M,I),T()},setIndicatorEnabled(M,I){Q.setEnabled(M,I),T()},listIndicators(){return Q.list()},invalidateCustomIndicators(){Q.invalidateCompute(),T()},get license(){return{plan:s.plan,valid:s.valid,expired:!!s.expired,watermark:!!s.watermark,daysLeft:s.daysLeft,features:s.features||{}}},setLicenseKey(M){s=Mt(M),!s.valid&&!s.expired&&console.error(`[MRD Chart Engine] ${s.error}`),it=Pt(s.plan);try{let I=s.expired?2:s.watermark?1:0,A=s.daysLeft||0,b=1297237059;b=Math.imul(b,31)+I>>>0,b=Math.imul(b,31)+A>>>0,b=(b^b>>>16)>>>0,b=Math.imul(b,73244475)>>>0,b=(b^b>>>16)>>>0,l.set_license_state(I,A,b)}catch{}return T(),s.valid},...be,...Ae,...ve}}function $e(t,o){let{t:i,o:s,h:p,l:e,c:n,v:r}=t,a=n.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let u=[],l=[],g=[],f=[],d=[],_=[],c=Math.round(n[0]/o)*o,h=0;for(let w=0;w<a;w++){h+=r[w];let L=n[w]-c;for(;L>=o;){let S=c,C=c+o;u.push(i[w]),l.push(S),g.push(C),f.push(S),d.push(C),_.push(h),h=0,c=C}for(;-L>=o;){let S=c,C=c-o;u.push(i[w]),l.push(S),g.push(S),f.push(C),d.push(C),_.push(h),h=0,c=C}}return{t:u,o:l,h:g,l:f,c:d,v:_}}function Je(t,o){let{t:i,o:s,h:p,l:e,c:n,v:r}=t,a=n.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let u=[],l=[],g=[],f=[],d=[],_=[],c=s[0],h=p[0],w=e[0],m=0,L=i[0];for(let S=0;S<a;S++)for(h=Math.max(h,p[S]),w=Math.min(w,e[S]),m+=r[S];h-w>=o;){let C=n[S]>=c,N=C?w+o:h-o;if(u.push(L),l.push(c),g.push(h),f.push(w),d.push(N),_.push(m),c=N,h=C?Math.max(p[S],N):N,w=C?N:Math.min(e[S],N),m=0,L=i[S],h-w<o)break}return(m>0||u.length===0)&&(u.push(L),l.push(c),g.push(h),f.push(w),d.push(n[a-1]),_.push(m)),{t:u,o:l,h:g,l:f,c:d,v:_}}function ke(t,o){let{t:i,o:s,h:p,l:e,c:n,v:r}=t,a=n.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let u=[],l=[],g=[],f=[],d=[],_=[],c=Math.max(1,Math.round(o));for(let h=0;h<a;h+=c){let w=Math.min(h+c,a),m=-1/0,L=1/0,S=0;for(let C=h;C<w;C++)p[C]>m&&(m=p[C]),e[C]<L&&(L=e[C]),S+=r[C];u.push(i[h]),l.push(s[h]),g.push(m),f.push(L),d.push(n[w-1]),_.push(S)}return{t:u,o:l,h:g,l:f,c:d,v:_}}function tr(t,o){let i=t>1e4?50:t>1e3?10:t>100?1:t>1?.1:.001,s=i*2,p=o<=60?10:o<=300?5:3;return{brickSize:i,rangeSize:s,tickCount:p}}var er={minRefills:3,hiddenRatio:2,refillWindowMs:1e4,maxTrackedLevels:200,maxEvents:500,decayMs:3e5};function rr(t={}){let o={...er,...t},i=new Map,s=new Map,p=[],e=0;function n(f){return Math.round(f*1e8)/1e8}function r(f,d,_,c){for(let[h,w]of f){let m=n(h),L=d.get(m);if(!L){d.set(m,{lastVol:w,refills:0,totalConsumed:0,lastRefillTs:c,peakVisible:w});continue}if(w<L.lastVol*.3&&L.lastVol>0){let S=L.lastVol-w;L.totalConsumed+=S,L.lastVol=w;continue}if(w>L.lastVol*1.5&&L.totalConsumed>0)if(c-L.lastRefillTs<o.refillWindowMs){if(L.refills++,L.lastRefillTs=c,L.peakVisible=Math.max(L.peakVisible,w),L.refills>=o.minRefills){let C=L.totalConsumed,N=L.peakVisible;C>=N*o.hiddenRatio&&(p.push({timestamp:c,price:h,visibleSize:N,hiddenSize:C,isBid:_,refillCount:L.refills}),p.length>o.maxEvents&&p.shift(),L.refills=0,L.totalConsumed=0)}}else L.refills=1,L.totalConsumed=0,L.lastRefillTs=c;L.lastVol=w}if(d.size>o.maxTrackedLevels){let h=[...d.entries()];h.sort((m,L)=>m[1].lastRefillTs-L[1].lastRefillTs);let w=h.length-o.maxTrackedLevels;for(let m=0;m<w;m++)d.delete(h[m][0])}}function a(f,d,_){let c=_||Date.now();e=c;let h=f instanceof Map?f:new Map(f.map(([L,S])=>[L,S])),w=d instanceof Map?d:new Map(d.map(([L,S])=>[L,S]));r(h,i,!0,c),r(w,s,!1,c);let m=c-o.decayMs;for(;p.length>0&&p[0].timestamp<m;)p.shift()}function u(){return p}function l(f){if(!f||p.length===0)return;let d=p.length,_=new Float64Array(d),c=new Float64Array(d),h=new Float64Array(d),w=new Float64Array(d),m=new Uint8Array(d),L=new Uint32Array(d);for(let S=0;S<d;S++){let C=p[S];_[S]=C.timestamp,c[S]=C.price,h[S]=C.visibleSize,w[S]=C.hiddenSize,m[S]=C.isBid?1:0,L[S]=C.refillCount}f.setIcebergEvents(_,c,h,w,m,L)}function g(){i.clear(),s.clear(),p.length=0}return{onOrderbookUpdate:a,getEvents:u,pushToEngine:l,reset:g}}export{Je as buildRange,$e as buildRenko,ke as buildTick,xe as createChartBridge,Nt as createCustomIndicatorManager,rr as createIcebergDetector,nt as dispatchCommands,Ue as generateLicenseKey,Qe as prefetchWasm,yt as setupEvents,tr as suggestDefaults,Mt as validateLicense};
|
|
1
|
+
var P={FILL_RECT:1,STROKE_RECT:2,LINE:3,DASHED_LINE:4,POLYLINE:5,TEXT:6,CIRCLE:7,TRIANGLE:8,SAVE:9,RESTORE:10,CLIP_RECT:11,ROTATED_TEXT:12,BUBBLE_3D:13,FILL_POLYGON:14,DASHED_POLYLINE:15,END_FRAME:255},Pe=["left","center","right"],St=new Map,Re=4096;function Ye(t,o,n,s){return t<<24|o<<16|n<<8|s}function Z(t,o,n,s){let p=Ye(t,o,n,s),r=St.get(p);return r||(r=`rgba(${t},${o},${n},${(s/255).toFixed(3)})`,St.size>=Re&&St.clear(),St.set(p,r),r)}var Kt=new TextDecoder;function ft(t,o,n,s){let p=o.buffer;if(n+s>p.byteLength)return;let r=new DataView(p,n,s),i=new Uint8Array(p,n,s),e=0,a="",f="",l=-1,g="";for(;e<s;){let u=i[e];if(e+=1,u===P.END_FRAME)break;switch(u){case P.FILL_RECT:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=r.getFloat32(e,!0);e+=4;let w=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4,w!==a&&(t.fillStyle=w,a=w),t.fillRect(_,c,h,d);break}case P.STROKE_RECT:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=r.getFloat32(e,!0);e+=4;let w=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let m=r.getFloat32(e,!0);e+=4,w!==f&&(t.strokeStyle=w,f=w),m!==l&&(t.lineWidth=m,l=m),t.strokeRect(_,c,h,d);break}case P.LINE:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=r.getFloat32(e,!0);e+=4;let w=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let m=r.getFloat32(e,!0);e+=4,t.beginPath(),w!==f&&(t.strokeStyle=w,f=w),m!==l&&(t.lineWidth=m,l=m),t.setLineDash([]),t.moveTo(_,c),t.lineTo(h,d),t.stroke();break}case P.DASHED_LINE:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=r.getFloat32(e,!0);e+=4;let w=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let m=r.getFloat32(e,!0);e+=4;let M=r.getFloat32(e,!0);e+=4;let I=r.getFloat32(e,!0);e+=4,t.beginPath(),w!==f&&(t.strokeStyle=w,f=w),m!==l&&(t.lineWidth=m,l=m),t.setLineDash([M,I]),t.moveTo(_,c),t.lineTo(h,d),t.stroke(),t.setLineDash([]);break}case P.POLYLINE:{let _=r.getUint16(e,!0);e+=2;let c=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let h=r.getFloat32(e,!0);if(e+=4,_>0){let d=new Float32Array(_*2);for(let w=0;w<_;w++)d[w*2]=r.getFloat32(e,!0),e+=4,d[w*2+1]=r.getFloat32(e,!0),e+=4;if(t.beginPath(),c!==f&&(t.strokeStyle=c,f=c),h!==l&&(t.lineWidth=h,l=h),t.setLineDash([]),t.lineJoin="round",t.lineCap="round",_<=3){t.moveTo(d[0],d[1]);for(let w=1;w<_;w++)t.lineTo(d[w*2],d[w*2+1])}else{t.moveTo(d[0],d[1]),t.lineTo((d[0]+d[2])*.5,(d[1]+d[3])*.5);for(let w=1;w<_-1;w++){let m=d[w*2],M=d[w*2+1],I=d[(w+1)*2],C=d[(w+1)*2+1];t.quadraticCurveTo(m,M,(m+I)*.5,(M+C)*.5)}t.lineTo(d[(_-1)*2],d[(_-1)*2+1])}t.stroke()}break}case P.TEXT:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let d=r.getFloat32(e,!0);e+=4;let w=i[e];e+=1;let m=r.getUint16(e,!0);e+=2;let M=Kt.decode(new Uint8Array(o.buffer,n+e,m));e+=m,h!==a&&(t.fillStyle=h,a=h);let I=`${d}px "IBM Plex Mono",monospace`;I!==g&&(t.font=I,g=I),t.textAlign=Pe[w]||"left",t.textBaseline="middle",t.fillText(M,_,c);break}case P.CIRCLE:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let w=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let m=r.getFloat32(e,!0);e+=4,t.beginPath(),t.arc(_,c,h,0,Math.PI*2),d!==a&&(t.fillStyle=d,a=d),t.fill(),m>0&&(w!==f&&(t.strokeStyle=w,f=w),m!==l&&(t.lineWidth=m,l=m),t.stroke());break}case P.TRIANGLE:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=r.getFloat32(e,!0);e+=4;let w=r.getFloat32(e,!0);e+=4;let m=r.getFloat32(e,!0);e+=4;let M=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4,t.beginPath(),t.moveTo(_,c),t.lineTo(h,d),t.lineTo(w,m),t.closePath(),M!==a&&(t.fillStyle=M,a=M),t.fill();break}case P.SAVE:{t.save();break}case P.RESTORE:{t.restore(),a="",f="",l=-1,g="";break}case P.CLIP_RECT:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=r.getFloat32(e,!0);e+=4,t.beginPath(),t.rect(_,c,h,d),t.clip();break}case P.ROTATED_TEXT:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let d=r.getFloat32(e,!0);e+=4;let w=r.getFloat32(e,!0);e+=4;let m=r.getUint16(e,!0);e+=2;let M=Kt.decode(i.subarray(e,e+m));e+=m;let I=`${d}px sans-serif`;I!==g&&(t.font=I,g=I),h!==a&&(t.fillStyle=h,a=h),t.textAlign="center",t.textBaseline="middle",t.save(),t.translate(_,c),t.rotate(w),t.fillText(M,0,0),t.restore();break}case P.BUBBLE_3D:{let _=r.getFloat32(e,!0);e+=4;let c=r.getFloat32(e,!0);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=i[e],w=i[e+1],m=i[e+2],M=i[e+3];e+=4;let I=i[e],C=i[e+1],y=i[e+2],$=i[e+3];e+=4;let T=i[e],tt=i[e+1],et=i[e+2],gt=i[e+3];e+=4;let bt=r.getFloat32(e,!0);e+=4;let E=h;if(E<10){let O=`rgba(${d},${w},${m},${(M/255).toFixed(3)})`;t.beginPath(),t.arc(_,c,E,0,Math.PI*2),t.fillStyle=O,t.fill(),a=""}else if(E<18){let O=_-E*.25,G=c-E*.25,W=t.createRadialGradient(O,G,E*.08,_,c,E);W.addColorStop(0,`rgba(${I},${C},${y},${($/255).toFixed(3)})`),W.addColorStop(1,`rgba(${d},${w},${m},${(M/255).toFixed(3)})`),t.beginPath(),t.arc(_,c,E,0,Math.PI*2),t.fillStyle=W,t.fill(),a=""}else{let O=_-E*.25,G=c-E*.25,W=t.createRadialGradient(_,c,E*.85,_,c,E*1.2);W.addColorStop(0,`rgba(${T},${tt},${et},${(gt/255*.5).toFixed(3)})`),W.addColorStop(1,`rgba(${T},${tt},${et},0)`),t.beginPath(),t.arc(_,c,E*1.2,0,Math.PI*2),t.fillStyle=W,t.fill();let B=t.createRadialGradient(O,G,E*.08,_,c,E);B.addColorStop(0,`rgba(${I},${C},${y},${($/255).toFixed(3)})`),B.addColorStop(1,`rgba(${d},${w},${m},${(M/255).toFixed(3)})`),t.beginPath(),t.arc(_,c,E,0,Math.PI*2),t.fillStyle=B,t.fill();let lt=E*.2,rt=t.createRadialGradient(O,G,0,O,G,lt);rt.addColorStop(0,"rgba(255,255,255,0.22)"),rt.addColorStop(1,"rgba(255,255,255,0)"),t.beginPath(),t.arc(O,G,lt,0,Math.PI*2),t.fillStyle=rt,t.fill(),a=""}break}case P.FILL_POLYGON:{let _=r.getUint16(e,!0);e+=2;let c=Z(i[e],i[e+1],i[e+2],i[e+3]);if(e+=4,_>2){t.beginPath();let h=r.getFloat32(e,!0);e+=4;let d=r.getFloat32(e,!0);e+=4,t.moveTo(h,d);for(let w=1;w<_;w++)t.lineTo(r.getFloat32(e,!0),r.getFloat32(e+4,!0)),e+=8;t.closePath(),c!==a&&(t.fillStyle=c,a=c),t.fill()}else e+=_*8;break}case P.DASHED_POLYLINE:{let _=r.getUint16(e,!0);e+=2;let c=Z(i[e],i[e+1],i[e+2],i[e+3]);e+=4;let h=r.getFloat32(e,!0);e+=4;let d=r.getFloat32(e,!0);e+=4;let w=r.getFloat32(e,!0);if(e+=4,_>1){t.beginPath(),c!==f&&(t.strokeStyle=c,f=c),h!==l&&(t.lineWidth=h,l=h),t.setLineDash([d,w]),t.lineJoin="round";let m=r.getFloat32(e,!0);e+=4;let M=r.getFloat32(e,!0);e+=4,t.moveTo(m,M);for(let I=1;I<_;I++)t.lineTo(r.getFloat32(e,!0),r.getFloat32(e+4,!0)),e+=8;t.stroke(),t.setLineDash([])}else e+=_*8;break}default:return}}}var z={trendline:{type:"2point",previewKind:0,addFn:"add_trendline"},arrow:{type:"2point",previewKind:4,addFn:"add_arrow"},measure:{type:"2point",previewKind:2,addFn:"add_price_range"},fib:{type:"2point",previewKind:3,addFn:"add_fib_retracement"},long:{type:"2point",previewKind:5,addFn:"add_long_position"},short:{type:"2point",previewKind:5,addFn:"add_short_position"},hline:{type:"1point_xp",previewKind:1,addFn:"add_horizontal_line"},vwap:{type:"1point_x",previewKind:6,addFn:"add_anchored_vwap"},pricelabel:{type:"1point_xy",previewKind:7,addFn:"add_price_label"},circle:{type:"2point",previewKind:8,addFn:"add_circle"},arrowup:{type:"1point_xy",previewKind:9,addFn:"add_arrow_marker_up"},arrowdown:{type:"1point_xy",previewKind:10,addFn:"add_arrow_marker_down"},textnote:{type:"1point_xy",previewKind:11,addFn:"add_text_note"},channel:{type:"3point",previewKind:0,addFn:"add_parallel_channel"},fibext:{type:"3point",previewKind:0,addFn:"add_fib_extension",previewFn:"fib_ext"},brush:{type:"freehand"},path:{type:"npoint"},elliott:{type:"elliott_manual"},elliottauto:{type:"1point_xy",previewKind:12,addFn:"add_elliott_impulse",previewFn:"elliott"}};function _t(t){return z[t]?.type==="2point"}function dt(t){return z[t]?.type==="3point"}function st(t){let o=z[t]?.type;return o==="1point"||o==="1point_x"||o==="1point_xy"||o==="1point_xp"}function It(t){return z[t]?.type==="freehand"}function q(t){return z[t]?.type==="npoint"}function K(t){return z[t]?.type==="elliott_manual"}var Ut={r:.04,g:.49,b:1,lineWidth:2,dashed:!1,fontSize:12};function U(t,o,n,s,p,r){r=r||Ut;let i=z[o];if(!i)return 0;let e=0;return i.type==="3point"?e=t[i.addFn](n.x1,n.y1,n.x2,n.y2,s,p,r.r,r.g,r.b,r.lineWidth,r.dashed,n.pane):i.type==="2point"?e=t[i.addFn](n.x1,n.y1,s,p,r.r,r.g,r.b,r.lineWidth,r.dashed,n.pane):i.type==="1point_x"?e=t[i.addFn](s,r.r,r.g,r.b,r.lineWidth,r.dashed,n.pane):i.type==="1point_xp"?e=t[i.addFn](s,p,r.r,r.g,r.b,r.lineWidth,r.dashed,n.pane):i.type==="1point_xy"?e=t[i.addFn](s,p,r.r,r.g,r.b,r.fontSize||12,n.pane):e=t[i.addFn](p,r.r,r.g,r.b,r.lineWidth,r.dashed,n.pane),e||0}function D(t,o,n,s,p,r,i){r=r||Ut;let e=z[o];if(e){if(e.previewFn==="elliott"){t.set_elliott_preview(s,p,r.r,r.g,r.b,r.lineWidth,i);return}e.type==="3point"?n.step===1?t.set_drawing_preview(e.previewKind,n.x1,n.y1,s,p,r.r,r.g,r.b,r.lineWidth,r.dashed,i):n.step===2&&(e.previewFn==="fib_ext"?t.set_fib_ext_preview(n.x1,n.y1,n.x2,n.y2,s,p,r.r,r.g,r.b,r.lineWidth,r.dashed,i):t.set_channel_preview(n.x1,n.y1,n.x2,n.y2,s,p,r.r,r.g,r.b,r.lineWidth,r.dashed,i)):e.type==="2point"?t.set_drawing_preview(e.previewKind,n.x1,n.y1,s,p,r.r,r.g,r.b,r.lineWidth,r.dashed,i):e.type==="1point_x"?t.set_drawing_preview(e.previewKind,s,0,0,0,r.r,r.g,r.b,r.lineWidth,r.dashed,i):e.type==="1point_xp"||e.type==="1point_xy"?t.set_drawing_preview(e.previewKind,s,p,0,0,r.r,r.g,r.b,r.lineWidth,r.dashed,i):t.set_drawing_preview(e.previewKind,0,p,0,0,r.r,r.g,r.b,r.lineWidth,r.dashed,i)}}function v(t,o,n,s){let p=t.screen_to_world_x(o),r;switch(s){case 1:r=t.screen_to_rsi_y(n);break;case 2:r=t.screen_to_oi_y(n);break;case 3:r=t.screen_to_fr_y(n);break;case 4:r=t.screen_to_cvd_y(n);break;case 5:r=t.screen_to_vpin_y(n);break;default:r=t.screen_to_world_y(n);break}return{wx:p,wy:r}}function H(t){return t===4?1:t===6?2:t===8?3:t===10?4:t===12?5:0}function k(t){return t===4||t===6||t===8||t===10||t===12}function Y(t){return t===14||t===15||t===16||t===17||t===18}function X(t){return t===4||t===14?1:t===6||t===15?2:t===8||t===16?3:t===10||t===17?4:t===12||t===18?5:0}function x(t,o,n,s){k(o)?(t.pan(n,0),Math.abs(s)>.01&&t.pan_indicator_y(X(o),s)):t.pan(n,s)}function F(t){return t===0||t===4||t===6||t===8||t===10||t===12}function ee(t,o,n,s){t.addEventListener("wheel",e=>{if(s.disposed)return;e.preventDefault(),s.cancelMomentum();let a=e.deltaY>0?1.1:.9,f=o.hit_zone(e.offsetX,e.offsetY);Y(f)?o.zoom_indicator_y(X(f),e.offsetY,a):k(f)?e.ctrlKey?o.zoom_indicator_y(X(f),e.offsetY,a):o.zoom_x(e.offsetX,a):e.ctrlKey?o.zoom_y(e.offsetY,a):e.shiftKey||f===2?o.zoom_x(e.offsetX,a):f===3?o.zoom_y(e.offsetY,a):o.zoom(e.offsetX,e.offsetY,a),n.onDirty()},{passive:!1}),t.addEventListener("mousedown",e=>{if(s.disposed||e.button!==0)return;s.cancelMomentum(),r();let a=performance.now();if(a-s.lastClickTime<300){s.lastClickTime=a;return}s.lastClickTime=a;let f=s.drawingMode;if(f){let g=o.hit_zone(e.offsetX,e.offsetY);if(!F(g))return;let u=H(g),{wx:_,wy:c}=v(o,e.offsetX,e.offsetY,u),h=f.style,d=f.tool;if(K(d)){if(!f.pathStarted)f.pane=u,o.start_elliott_manual(h.r,h.g,h.b,h.lineWidth,u),o.add_elliott_manual_point(_,c),f.pathStarted=!0,f.step=1;else if(o.add_elliott_manual_point(_,c)){s.finishDrawing(),n.onDirty();return}}else if(q(d))f.pathStarted?o.add_path_point(_,c):(f.pane=u,o.start_path(h.r,h.g,h.b,h.lineWidth,h.dashed,u),o.add_path_point(_,c),f.pathStarted=!0,f.step=1);else if(It(d))f.pane=u,o.start_brush(h.r,h.g,h.b,h.lineWidth,u),o.add_brush_point(_,c),s.isBrushing=!0;else if(dt(d))if(f.step===0)f.x1=_,f.y1=c,f.pane=u,f.step=1;else if(f.step===1)f.x2=_,f.y2=c,f.step=2,o.clear_drawing_preview();else{let w=z[d];w&&w.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),U(o,d,f,_,c,h),s.finishDrawing()}else if(_t(d))f.step===0?(f.x1=_,f.y1=c,f.pane=u,f.step=1):(U(o,d,f,_,c,h),s.finishDrawing());else{f.pane=u;let w=U(o,d,f,_,c,h);s.finishDrawing(),d==="textnote"&&w>0&&(o.select_drawing(w),n.onDrawingSelected?.(w),n.onDrawingDblClick?.(w,e.offsetX,e.offsetY,e.clientX,e.clientY))}n.onDirty();return}let l=o.hit_zone(e.offsetX,e.offsetY);if(l===5){s.isResizingRsi=!0,s.resizeStartY=e.offsetY,s.resizeStartRatio=o.get_rsi_ratio(),t.style.cursor="ns-resize";return}if(l===7){s.isResizingOi=!0,s.resizeStartY=e.offsetY,s.resizeStartRatio=o.get_oi_ratio(),t.style.cursor="ns-resize";return}if(l===9){s.isResizingFr=!0,s.resizeStartY=e.offsetY,s.resizeStartRatio=o.get_fr_ratio(),t.style.cursor="ns-resize";return}if(l===11){s.isResizingCvd=!0,s.resizeStartY=e.offsetY,s.resizeStartRatio=o.get_cvd_ratio(),t.style.cursor="ns-resize";return}if(l===13){s.isResizingVpin=!0,s.resizeStartY=e.offsetY,s.resizeStartRatio=o.get_vpin_ratio(),t.style.cursor="ns-resize";return}if(F(l)){let g=o.get_selected_drawing();if(g>0){let d=o.hit_test_drawing_anchor(e.offsetX,e.offsetY);if(d>=0){s.isDraggingAnchor=!0,s.dragAnchorIdx=d,s.dragAnchorPane=H(l),t.style.cursor="grabbing";return}if(o.hit_test_drawing(e.offsetX,e.offsetY)===g){s.isDraggingDrawing=!0,s.dragDrawingPane=H(l);let{wx:m,wy:M}=v(o,e.offsetX,e.offsetY,s.dragDrawingPane);s.dragDrawingLastWx=m,s.dragDrawingLastWy=M,t.style.cursor="move";return}}let u=o.hit_test_drawing(e.offsetX,e.offsetY);if(u>0){o.deselect_marker(),n.onMarkerSelected?.(0),o.select_drawing(u),n.onDrawingSelected?.(u),n.onDirty();return}let _=o.hit_test_marker(e.offsetX,e.offsetY);if(_>0){o.deselect_drawing(),n.onDrawingSelected?.(0),o.select_marker(_),n.onMarkerSelected?.(_),n.onDirty();return}let c=o.get_selected_drawing(),h=o.get_selected_marker();c>0&&(o.deselect_drawing(),n.onDrawingSelected?.(0),n.onDirty()),h>0&&(o.deselect_marker(),n.onMarkerSelected?.(0),n.onDirty())}F(l)&&(s.liqPinSx=e.offsetX,s.liqPinSy=e.offsetY,s.liqPinTimer&&clearTimeout(s.liqPinTimer),s.liqPinTimer=setTimeout(()=>{s.liqPinTimer=null,n.onLiqAnnotationPin?.(s.liqPinSx,s.liqPinSy)},700)),s.isDragging=!0,s.dragZone=l,s.lastX=e.offsetX,s.lastY=e.offsetY,l===2?t.style.cursor="ew-resize":l===3||Y(l)?t.style.cursor="ns-resize":t.style.cursor="grabbing"});let p=null;function r(){p&&(cancelAnimationFrame(p),p=null)}function i(e,a){let f=o.hover_hit_test(e,a),l=f[0],g=f[1],u=f[2],_=f[3],c=f[4],h=s.drawingMode;l===2?(t.style.cursor="ew-resize",o.hide_crosshair()):l===3||Y(l)?(t.style.cursor="ns-resize",o.hide_crosshair()):(o.set_crosshair(e,a),l===5||l===7||l===9||l===11||l===13?t.style.cursor="ns-resize":!h&&F(l)&&g>0&&u>=0?t.style.cursor="grab":!h&&F(l)&&g>0&&_===g?t.style.cursor="move":!h&&F(l)&&(_>0||c>0)?t.style.cursor="pointer":t.style.cursor="crosshair"),n.onDirty(),n.onCrosshairMove?.(e,a,l),n.onVrvpHover?.(e,a)}t.addEventListener("mousemove",e=>{if(s.disposed)return;if(s.liqPinTimer){let f=Math.abs(e.offsetX-s.liqPinSx),l=Math.abs(e.offsetY-s.liqPinSy);(f>6||l>6)&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null)}if(s.isResizingRsi){let l=t.getBoundingClientRect().height-28,u=(s.resizeStartY-e.offsetY)/l,_=Math.max(.05,Math.min(.5,s.resizeStartRatio+u));o.set_rsi_ratio(_),n.onDirty();return}if(s.isResizingOi){let l=t.getBoundingClientRect().height-28,u=(s.resizeStartY-e.offsetY)/l,_=Math.max(.05,Math.min(.5,s.resizeStartRatio+u));o.set_oi_ratio(_),n.onDirty();return}if(s.isResizingFr){let l=t.getBoundingClientRect().height-28,u=(s.resizeStartY-e.offsetY)/l,_=Math.max(.05,Math.min(.5,s.resizeStartRatio+u));o.set_fr_ratio(_),n.onDirty();return}if(s.isResizingCvd){let l=t.getBoundingClientRect().height-28,u=(s.resizeStartY-e.offsetY)/l,_=Math.max(.05,Math.min(.5,s.resizeStartRatio+u));o.set_cvd_ratio(_),n.onDirty();return}if(s.isResizingVpin){let l=t.getBoundingClientRect().height-28,u=(s.resizeStartY-e.offsetY)/l,_=Math.max(.05,Math.min(.5,s.resizeStartRatio+u));o.set_vpin_ratio(_),n.onDirty();return}if(s.isDraggingAnchor){let{wx:f,wy:l}=v(o,e.offsetX,e.offsetY,s.dragAnchorPane);o.update_drawing_anchor(s.dragAnchorIdx,f,l),o.set_crosshair(e.offsetX,e.offsetY),n.onDirty(),n.onCrosshairMove?.(e.offsetX,e.offsetY,o.hit_zone(e.offsetX,e.offsetY));return}if(s.isDraggingDrawing){let{wx:f,wy:l}=v(o,e.offsetX,e.offsetY,s.dragDrawingPane),g=f-s.dragDrawingLastWx,u=l-s.dragDrawingLastWy;o.move_drawing(g,u),s.dragDrawingLastWx=f,s.dragDrawingLastWy=l,o.set_crosshair(e.offsetX,e.offsetY),n.onDirty(),n.onCrosshairMove?.(e.offsetX,e.offsetY,o.hit_zone(e.offsetX,e.offsetY));return}let a=s.drawingMode;if(s.isBrushing&&a){let f=a.pane||0,{wx:l,wy:g}=v(o,e.offsetX,e.offsetY,f);o.add_brush_point(l,g),o.set_crosshair(e.offsetX,e.offsetY),n.onDirty();return}if(a&&K(a.tool)&&a.pathStarted){let f=a.pane||0,{wx:l,wy:g}=v(o,e.offsetX,e.offsetY,f);o.set_elliott_manual_cursor(l,g),o.set_crosshair(e.offsetX,e.offsetY);let u=o.hit_zone(e.offsetX,e.offsetY);n.onDirty(),n.onCrosshairMove?.(e.offsetX,e.offsetY,u);return}if(a&&q(a.tool)&&a.pathStarted){let f=a.pane||0,{wx:l,wy:g}=v(o,e.offsetX,e.offsetY,f);o.set_path_cursor(l,g),o.set_crosshair(e.offsetX,e.offsetY);let u=o.hit_zone(e.offsetX,e.offsetY);n.onDirty(),n.onCrosshairMove?.(e.offsetX,e.offsetY,u);return}if(a&&a.step>0){let f=a.pane||0,{wx:l,wy:g}=v(o,e.offsetX,e.offsetY,f);D(o,a.tool,a,l,g,a.style,f),o.set_crosshair(e.offsetX,e.offsetY);let u=o.hit_zone(e.offsetX,e.offsetY);n.onDirty(),n.onCrosshairMove?.(e.offsetX,e.offsetY,u);return}if(a&&st(a.tool)){let f=o.hit_zone(e.offsetX,e.offsetY),l=H(f),{wx:g,wy:u}=v(o,e.offsetX,e.offsetY,l);D(o,a.tool,a,g,u,a.style,l),o.set_crosshair(e.offsetX,e.offsetY),n.onDirty(),n.onCrosshairMove?.(e.offsetX,e.offsetY,f);return}if(s.isDragging){let f=e.offsetX-s.lastX,l=e.offsetY-s.lastY;s.lastX=e.offsetX,s.lastY=e.offsetY,s.dragZone===2?o.pan_x(f):s.dragZone===3?o.pan_y(l):Y(s.dragZone)?o.pan_indicator_y(X(s.dragZone),l):x(o,s.dragZone,f,l),n.onDirty(),n.onCrosshairMove?.(e.offsetX,e.offsetY,s.dragZone),n.onVrvpHover?.(e.offsetX,e.offsetY);return}s._pendingHoverX=e.offsetX,s._pendingHoverY=e.offsetY,p||(p=requestAnimationFrame(()=>{p=null,s.disposed||i(s._pendingHoverX,s._pendingHoverY)}))}),t.addEventListener("mouseup",()=>{s.disposed||(s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isBrushing&&(s.isBrushing=!1,o.finish_brush(),s.finishDrawing(),n.onDirty()),s.isDragging=!1,s.isResizingRsi=!1,s.isResizingOi=!1,s.isResizingFr=!1,s.isResizingCvd=!1,s.isResizingVpin=!1,s.isDraggingAnchor=!1,s.isDraggingDrawing=!1,s.dragAnchorIdx=-1,t.style.cursor="crosshair")}),t.addEventListener("mouseleave",()=>{s.disposed||(r(),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isBrushing&&(s.isBrushing=!1,o.finish_brush(),s.finishDrawing()),s.isDragging=!1,s.isResizingRsi=!1,s.isResizingOi=!1,s.isResizingFr=!1,s.isResizingCvd=!1,s.isResizingVpin=!1,s.isDraggingAnchor=!1,s.isDraggingDrawing=!1,s.dragAnchorIdx=-1,o.hide_crosshair(),t.style.cursor="crosshair",n.onDirty(),n.onCrosshairHide?.(),n.onVrvpHover?.(null,null))}),t.addEventListener("dblclick",e=>{if(s.disposed)return;e.preventDefault(),e.stopPropagation();let a=s.drawingMode;if(a&&K(a.tool)&&a.pathStarted){o.finish_elliott_manual(),s.finishDrawing(),n.onDirty();return}if(a&&q(a.tool)&&a.pathStarted){o.finish_path(),s.finishDrawing(),n.onDirty();return}if(a)return;let f=o.hit_zone(e.offsetX,e.offsetY);if(k(f)||Y(f)){o.reset_indicator_y_auto(X(f)),n.onDirty();return}let l=o.hit_test_drawing(e.offsetX,e.offsetY);l>0&&(o.select_drawing(l),n.onDirty(),n.onDrawingDblClick?.(l,e.offsetX,e.offsetY,e.clientX,e.clientY))}),t.addEventListener("contextmenu",e=>{if(s.disposed)return;let a=s.drawingMode;if(a&&K(a.tool)&&a.pathStarted){e.preventDefault(),e.stopPropagation(),o.finish_elliott_manual(),s.finishDrawing(),n.onDirty();return}if(a&&q(a.tool)&&a.pathStarted){e.preventDefault(),e.stopPropagation(),o.finish_path(),s.finishDrawing(),n.onDirty();return}})}function re(t,o,n,s){t.addEventListener("touchstart",p=>{if(!s.disposed){if(p.preventDefault(),s.cancelMomentum(),p.touches.length===2){clearTimeout(s.longPressTimer),s.isCrosshairMode=!1;let r=t.getBoundingClientRect(),i=p.touches[1].clientX-p.touches[0].clientX,e=p.touches[1].clientY-p.touches[0].clientY;s.lastTouchDist=Math.sqrt(i*i+e*e),s.lastX=(p.touches[0].clientX+p.touches[1].clientX)/2-r.left,s.lastY=(p.touches[0].clientY+p.touches[1].clientY)/2-r.top,s.dragZone=o.hit_zone(s.lastX,s.lastY)}else if(p.touches.length===1){let r=t.getBoundingClientRect(),i=p.touches[0].clientX-r.left,e=p.touches[0].clientY-r.top;s.touchStartX=i,s.touchStartY=e,s.touchMoved=!1;let a=s.drawingMode;if(a){let _=o.hit_zone(i,e);if(F(_)){let c=H(_),{wx:h,wy:d}=v(o,i,e,c),w=a.tool;if(K(w)){if(!a.pathStarted)a.pane=c,o.start_elliott_manual(a.style.r,a.style.g,a.style.b,a.style.lineWidth,c),o.add_elliott_manual_point(h,d),a.pathStarted=!0,a.step=1;else if(o.add_elliott_manual_point(h,d)){s.finishDrawing(),n.onDirty();return}}else q(w)?a.pathStarted?o.add_path_point(h,d):(a.pane=c,o.start_path(a.style.r,a.style.g,a.style.b,a.style.lineWidth,a.style.dashed,c),o.add_path_point(h,d),a.pathStarted=!0,a.step=1):It(w)?(a.pane=c,o.start_brush(a.style.r,a.style.g,a.style.b,a.style.lineWidth,c),o.add_brush_point(h,d),s.isBrushing=!0):dt(w)?a.step===0?(a.x1=h,a.y1=d,a.pane=c,a.step=1,a._stepAtTouchStart=0,D(o,w,a,h,d,a.style,c)):a.step===1?(a._stepAtTouchStart=1,D(o,w,a,h,d,a.style,a.pane)):(a._stepAtTouchStart=2,D(o,w,a,h,d,a.style,a.pane)):_t(w)?a.step===0?(a.x1=h,a.y1=d,a.pane=c,a.step=1,a._stepAtTouchStart=0,D(o,w,a,h,d,a.style,c)):(a._stepAtTouchStart=1,D(o,w,a,h,d,a.style,a.pane)):st(w)?(a.pane=c,D(o,w,a,h,d,a.style,c)):(a.pane=c,U(o,w,a,h,d,a.style),s.finishDrawing());o.set_crosshair(i,e),n.onDirty(),n.onCrosshairMove?.(i,e,_)}return}let f=o.hover_hit_test(i,e),l=f[0],g=f[1],u=f[2];if(F(l)&&!s.drawingMode&&g>0){if(u>=0){s.isDraggingAnchor=!0,s.dragAnchorIdx=u,s.dragAnchorPane=H(l);return}if(f[3]===g){s.isDraggingDrawing=!0,s.dragDrawingPane=H(l);let{wx:c,wy:h}=v(o,i,e,s.dragDrawingPane);s.dragDrawingLastWx=c,s.dragDrawingLastWy=h;return}}s.isDragging=!0,s.isCrosshairMode=!1,s.lastX=i,s.lastY=e,s.dragZone=l,clearTimeout(s.longPressTimer),s.longPressTimer=setTimeout(()=>{s.isDragging&&!s.touchMoved&&(s.isCrosshairMode=!0,o.set_crosshair(i,e),n.onDirty(),n.onCrosshairMove?.(i,e,s.dragZone),n.onVrvpHover?.(i,e))},300),F(s.dragZone)&&(s.liqPinSx=i,s.liqPinSy=e,s.liqPinTimer&&clearTimeout(s.liqPinTimer),s.liqPinTimer=setTimeout(()=>{s.liqPinTimer=null,s.touchMoved||n.onLiqAnnotationPin?.(s.liqPinSx,s.liqPinSy)},700))}}},{passive:!1}),t.addEventListener("touchmove",p=>{if(s.disposed)return;p.preventDefault();let r=t.getBoundingClientRect();if(s.isDraggingAnchor&&p.touches.length===1){let e=p.touches[0].clientX-r.left,a=p.touches[0].clientY-r.top,{wx:f,wy:l}=v(o,e,a,s.dragAnchorPane);o.update_drawing_anchor(s.dragAnchorIdx,f,l),o.set_crosshair(e,a),n.onDirty();return}if(s.isDraggingDrawing&&p.touches.length===1){let e=p.touches[0].clientX-r.left,a=p.touches[0].clientY-r.top;s.touchMoved=!0;let{wx:f,wy:l}=v(o,e,a,s.dragDrawingPane),g=f-s.dragDrawingLastWx,u=l-s.dragDrawingLastWy;o.move_drawing(g,u),s.dragDrawingLastWx=f,s.dragDrawingLastWy=l,o.set_crosshair(e,a),n.onDirty();return}let i=s.drawingMode;if(s.isBrushing&&i&&p.touches.length===1){let e=p.touches[0].clientX-r.left,a=p.touches[0].clientY-r.top,f=i.pane||0,{wx:l,wy:g}=v(o,e,a,f);o.add_brush_point(l,g),o.set_crosshair(e,a),n.onDirty(),s.touchMoved=!0;return}if(i&&K(i.tool)&&i.pathStarted&&p.touches.length===1){let e=p.touches[0].clientX-r.left,a=p.touches[0].clientY-r.top,f=i.pane||0,{wx:l,wy:g}=v(o,e,a,f);o.set_elliott_manual_cursor(l,g),o.set_crosshair(e,a),n.onDirty(),s.touchMoved=!0;return}if(i&&q(i.tool)&&i.pathStarted&&p.touches.length===1){let e=p.touches[0].clientX-r.left,a=p.touches[0].clientY-r.top,f=i.pane||0,{wx:l,wy:g}=v(o,e,a,f);o.set_path_cursor(l,g),o.set_crosshair(e,a),n.onDirty(),s.touchMoved=!0;return}if(i&&i.step>0&&p.touches.length===1){let e=p.touches[0].clientX-r.left,a=p.touches[0].clientY-r.top;!s.touchMoved&&(Math.abs(e-s.touchStartX)>10||Math.abs(a-s.touchStartY)>10)&&(s.touchMoved=!0);let f=i.pane||0,{wx:l,wy:g}=v(o,e,a,f);D(o,i.tool,i,l,g,i.style,f),o.set_crosshair(e,a);let u=o.hit_zone(e,a);n.onDirty(),n.onCrosshairMove?.(e,a,u);return}if(i&&st(i.tool)&&p.touches.length===1){let e=p.touches[0].clientX-r.left,a=p.touches[0].clientY-r.top,f=o.hit_zone(e,a),l=H(f),{wx:g,wy:u}=v(o,e,a,l);D(o,i.tool,i,g,u,i.style,l),o.set_crosshair(e,a),n.onDirty(),n.onCrosshairMove?.(e,a,f);return}if(p.touches.length===2){s.velSamples=[];let e=p.touches[1].clientX-p.touches[0].clientX,a=p.touches[1].clientY-p.touches[0].clientY,f=Math.sqrt(e*e+a*a),l=s.lastTouchDist/f,g=(p.touches[0].clientX+p.touches[1].clientX)/2-r.left,u=(p.touches[0].clientY+p.touches[1].clientY)/2-r.top;s.dragZone===3?o.zoom_y(u,l):Y(s.dragZone)?o.zoom_indicator_y(X(s.dragZone),u,l):s.dragZone===2?o.zoom_x(g,l):k(s.dragZone)?(o.zoom_x(g,l),x(o,s.dragZone,g-s.lastX,u-s.lastY)):(o.zoom(g,u,l),x(o,s.dragZone,g-s.lastX,u-s.lastY)),s.lastTouchDist=f,s.lastX=g,s.lastY=u,n.onDirty()}else if(p.touches.length===1&&s.isDragging){let e=p.touches[0].clientX-r.left,a=p.touches[0].clientY-r.top,f=e-s.lastX,l=a-s.lastY;if(!s.touchMoved&&(Math.abs(e-s.touchStartX)>10||Math.abs(a-s.touchStartY)>10)&&(s.touchMoved=!0,s.isCrosshairMode||clearTimeout(s.longPressTimer),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null)),s.isCrosshairMode)o.set_crosshair(e,a),n.onDirty(),n.onCrosshairMove?.(e,a,s.dragZone),n.onVrvpHover?.(e,a);else{if(s.lastX=e,s.lastY=a,s.dragZone===3||Y(s.dragZone)||s.recordVelocity(f,l),s.dragZone===2)o.pan_x(f);else if(s.dragZone===3){let u=Math.pow(1.005,l);o.zoom_y(a,u)}else if(Y(s.dragZone)){let u=Math.pow(1.005,l);o.zoom_indicator_y(X(s.dragZone),a,u)}else x(o,s.dragZone,f,l);n.onDirty()}}},{passive:!1}),t.addEventListener("touchend",p=>{if(s.disposed)return;if(clearTimeout(s.longPressTimer),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isDraggingAnchor){s.isDraggingAnchor=!1,s.dragAnchorIdx=-1,o.hide_crosshair(),n.onDirty(),n.onCrosshairHide?.();return}if(s.isDraggingDrawing){if(s.isDraggingDrawing=!1,o.hide_crosshair(),n.onDirty(),n.onCrosshairHide?.(),!s.touchMoved){let i=o.get_selected_drawing();if(i>0){let e=t.getBoundingClientRect();n.onDrawingDblClick?.(i,s.touchStartX,s.touchStartY,s.touchStartX+e.left,s.touchStartY+e.top)}}return}if(s.isBrushing){s.isBrushing=!1,o.finish_brush(),s.finishDrawing(),n.onDirty(),n.onCrosshairHide?.();return}let r=s.drawingMode;if(r&&K(r.tool)&&r.pathStarted){let i=Date.now(),e=s.touchStartX-(s._pathLastTapX||0),a=s.touchStartY-(s._pathLastTapY||0),f=Math.sqrt(e*e+a*a);i-(s._pathLastTapTime||0)<350&&f<30?(o.finish_elliott_manual(),s.finishDrawing(),s._pathLastTapTime=0):(s._pathLastTapTime=i,s._pathLastTapX=s.touchStartX,s._pathLastTapY=s.touchStartY),s.isDragging=!1,s.lastTouchDist=0,n.onDirty();return}if(r&&q(r.tool)&&r.pathStarted){let i=Date.now(),e=s.touchStartX-(s._pathLastTapX||0),a=s.touchStartY-(s._pathLastTapY||0),f=Math.sqrt(e*e+a*a);i-(s._pathLastTapTime||0)<350&&f<30?(o.finish_path(),s.finishDrawing(),s._pathLastTapTime=0):(s._pathLastTapTime=i,s._pathLastTapX=s.touchStartX,s._pathLastTapY=s.touchStartY),s.isDragging=!1,s.lastTouchDist=0,n.onDirty();return}if(r&&dt(r.tool)){let i=r._stepAtTouchStart;if(r.step===1&&(i===1||s.touchMoved)){let e=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let f=a.clientX-e.left,l=a.clientY-e.top,g=r.pane||0,{wx:u,wy:_}=v(o,f,l,g);r.x2=u,r.y2=_,r.step=2,o.clear_drawing_preview()}}else if(r.step===2&&(i===2||s.touchMoved)){let e=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let f=a.clientX-e.left,l=a.clientY-e.top,g=r.pane||0,{wx:u,wy:_}=v(o,f,l,g),c=z[r.tool];c&&c.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),U(o,r.tool,r,u,_,r.style),s.finishDrawing()}}s.isDragging=!1,s.lastTouchDist=0,s.drawingMode||(o.hide_crosshair(),n.onCrosshairHide?.()),n.onDirty();return}if(r&&r.step===1&&_t(r.tool)){if(r._stepAtTouchStart===1||s.touchMoved){let e=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let f=a.clientX-e.left,l=a.clientY-e.top,g=r.pane||0,{wx:u,wy:_}=v(o,f,l,g);U(o,r.tool,r,u,_,r.style),s.finishDrawing()}}s.isDragging=!1,s.lastTouchDist=0,s.drawingMode||(o.hide_crosshair(),n.onCrosshairHide?.()),n.onDirty();return}if(r&&st(r.tool)){let i=t.getBoundingClientRect(),e=p.changedTouches?.[0];if(e){let a=e.clientX-i.left,f=e.clientY-i.top,l=o.hit_zone(a,f),g=F(l)?H(l):r.pane||0,{wx:u,wy:_}=v(o,a,f,g),c=r.tool;o.clear_drawing_preview();let h=U(o,c,r,u,_,r.style);s.finishDrawing(),c==="textnote"&&h>0&&(o.select_drawing(h),n.onDrawingSelected?.(h),n.onDrawingDblClick?.(h,a,f,a+i.left,f+i.top))}s.isDragging=!1,s.lastTouchDist=0,o.hide_crosshair(),n.onCrosshairHide?.(),n.onDirty();return}if(!s.touchMoved&&!s.drawingMode&&s.isDragging){let i=Date.now(),e=s.touchStartX-s.lastTapX,a=s.touchStartY-s.lastTapY,f=Math.sqrt(e*e+a*a),l=i-s.lastTapTime<350&&f<30,g=o.hover_hit_test(s.touchStartX,s.touchStartY),u=g[0],_=g[1],c=g[3],h=g[4];if(l&&(k(u)||Y(u)))o.reset_indicator_y_auto(X(u)),n.onDirty(),s.lastTapTime=i,s.lastTapX=s.touchStartX,s.lastTapY=s.touchStartY;else if(F(u))if(c>0){o.deselect_marker(),n.onMarkerSelected?.(0),o.select_drawing(c);let d=t.getBoundingClientRect(),w=s.touchStartX+d.left,m=s.touchStartY+d.top;n.onDrawingSelected?.(c,w,m),(_<=0||_===c)&&n.onDrawingDblClick?.(c,s.touchStartX,s.touchStartY,w,m),n.onDirty()}else h>0?(o.deselect_drawing(),n.onDrawingSelected?.(0),o.select_marker(h),n.onMarkerSelected?.(h),n.onDirty()):(_>0&&(o.deselect_drawing(),n.onDrawingSelected?.(0),n.onDirty()),o.get_selected_marker()>0&&(o.deselect_marker(),n.onMarkerSelected?.(0),n.onDirty()));s.lastTapTime=i,s.lastTapX=s.touchStartX,s.lastTapY=s.touchStartY}s.touchMoved&&!s.isCrosshairMode&&!s.drawingMode&&s.dragZone!==3&&!Y(s.dragZone)&&s.startMomentum(s.dragZone),s.isDragging=!1,s.isCrosshairMode=!1,s.lastTouchDist=0,(!s.drawingMode||s.drawingMode.step===0)&&(o.hide_crosshair(),n.onCrosshairHide?.()),n.onDirty(),n.onVrvpHover?.(null,null)})}function Yt(t,o,n){let s={disposed:!1,isDragging:!1,dragZone:0,lastX:0,lastY:0,lastTouchDist:0,isResizingRsi:!1,isResizingOi:!1,isResizingFr:!1,isResizingCvd:!1,resizeStartY:0,resizeStartRatio:0,lastClickTime:0,isDraggingAnchor:!1,dragAnchorIdx:-1,dragAnchorPane:0,isBrushing:!1,isDraggingDrawing:!1,dragDrawingPane:0,dragDrawingLastWx:0,dragDrawingLastWy:0,touchStartX:0,touchStartY:0,touchMoved:!1,longPressTimer:null,isCrosshairMode:!1,liqPinTimer:null,liqPinSx:0,liqPinSy:0,velSamples:[],momentumRaf:null,momentumVx:0,momentumVy:0,momentumZone:0,lastTapTime:0,lastTapX:0,lastTapY:0,drawingMode:null},p=.92,r=.5,i=80;s.recordVelocity=function(l,g){let u=performance.now();for(s.velSamples.push({dx:l,dy:g,t:u});s.velSamples.length>0&&u-s.velSamples[0].t>i;)s.velSamples.shift()};function e(){if(s.velSamples.length<2)return{vx:0,vy:0};let l=s.velSamples[0],u=s.velSamples[s.velSamples.length-1].t-l.t;if(u<5)return{vx:0,vy:0};let _=0,c=0;for(let d of s.velSamples)_+=d.dx,c+=d.dy;let h=16.67;return{vx:_/u*h,vy:c/u*h}}s.cancelMomentum=function(){s.momentumRaf&&(cancelAnimationFrame(s.momentumRaf),s.momentumRaf=null),s.velSamples=[]},s.startMomentum=function(l){let{vx:g,vy:u}=e();if(s.velSamples=[],Math.abs(g)<r&&Math.abs(u)<r)return;s.momentumVx=g,s.momentumVy=u,s.momentumZone=l;function _(){if(s.momentumVx*=p,s.momentumVy*=p,Math.abs(s.momentumVx)<r&&Math.abs(s.momentumVy)<r){s.momentumRaf=null;return}s.momentumZone===2?o.pan_x(s.momentumVx):s.momentumZone===3?o.pan_y(s.momentumVy):Y(s.momentumZone)?o.pan_indicator_y(X(s.momentumZone),s.momentumVy):x(o,s.momentumZone,s.momentumVx,s.momentumVy),n.onDirty(),s.momentumRaf=requestAnimationFrame(_)}s.momentumRaf=requestAnimationFrame(_)};let a={setMode(l,g){l?(s.drawingMode={tool:l,style:g,step:0,x1:0,y1:0},t.style.cursor="crosshair"):(s.drawingMode?.pathStarted&&o.finish_path(),s.drawingMode=null,o.clear_drawing_preview(),t.style.cursor="crosshair"),n.onDirty()},getMode(){return s.drawingMode}};n.drawingApi?.(a),s.finishDrawing=function(){o.clear_drawing_preview(),n.onDrawingComplete?.(),s.drawingMode=null,t.style.cursor="crosshair"},ee(t,o,n,s),re(t,o,n,s);let f=l=>{let g=document.activeElement?.tagName,u=g==="INPUT"||g==="TEXTAREA"||document.activeElement?.isContentEditable;if((l.key==="Delete"||l.key==="Backspace")&&!s.drawingMode&&!u){let c=o.get_selected_drawing();if(c>0){o.remove_drawing(c),n.onDrawingSelected?.(0),n.onDirty();return}let h=o.get_selected_marker();if(h>0){o.remove_marker(h),n.onMarkerSelected?.(0),n.onDirty();return}}if(l.key==="Escape"&&!s.drawingMode){if(o.get_selected_drawing()>0){o.deselect_drawing(),n.onDrawingSelected?.(0),n.onDirty();return}if(o.get_selected_marker()>0){o.deselect_marker(),n.onMarkerSelected?.(0),n.onDirty();return}}if(l.key==="Escape"&&s.drawingMode){if(s.drawingMode.pathStarted){s.drawingMode.tool==="elliott"?o.finish_elliott_manual():o.finish_path(),s.finishDrawing(),n.onDirty();return}o.clear_drawing_preview(),s.drawingMode=null,t.style.cursor="crosshair",n.onDrawingCancel?.(),n.onDirty();return}let _=20;switch(l.key){case"+":case"=":o.zoom(t.width/2,t.height/2,.9);break;case"-":o.zoom(t.width/2,t.height/2,1.1);break;case"ArrowLeft":o.pan_x(_);break;case"ArrowRight":o.pan_x(-_);break;case"ArrowUp":o.pan_y(-_);break;case"ArrowDown":o.pan_y(_);break;case"r":case"R":o.auto_scale_y();for(let c=1;c<=5;c++)o.reset_indicator_y_auto(c);break;default:return}n.onDirty()};return window.addEventListener("keydown",f),()=>{s.disposed=!0,s.cancelMomentum(),window.removeEventListener("keydown",f)}}function se(t,o,n,s){let p=r=>s()(r);return{enableRsi(){t.enable_rsi(),o()},disableRsi(){t.disable_rsi(),o()},setRsiPeriod(r){t.set_rsi_period(r),o()},isRsiEnabled(){return t.is_rsi_enabled()},setRsiShowEma(r){t.set_rsi_show_ema(r),o()},setRsiShowWma(r){t.set_rsi_show_wma(r),o()},setRsiShowSignals(r){t.set_rsi_show_signals(r),o()},setRsiShowDivergence(r){t.set_rsi_show_divergence(r),o()},setRsiShowTraps(r){t.set_rsi_show_traps(r),o()},setRsiSmoothing(r){t.set_rsi_smoothing(r),o()},setRsiRatio(r){t.set_rsi_ratio(r),o()},getRsiRatio(){return t.get_rsi_ratio()},enableForexSignals(){p("forexSignals")&&(t.enable_forex_signals(),o())},disableForexSignals(){t.disable_forex_signals(),o()},isForexSignalsEnabled(){return t.is_forex_signals_enabled()},setForexSignalsSetup(r){t.set_forex_signals_setup(r),o()},setForexSignalsMode(r){t.set_forex_signals_mode(r),o()},setForexSignalsShowStats(r){t.set_forex_signals_show_stats(r),o()},getForexSignalsCount(){return t.get_forex_signals_count()},enableOi(){n()||p("oi")&&(t.enable_oi(),o())},disableOi(){n()||(t.disable_oi(),o())},isOiEnabled(){if(n())return!1;try{return t.is_oi_enabled()}catch{return!1}},setOiData(r){n()||(t.set_oi_data(r),o())},setOiDataTs(r,i){n()||(t.set_oi_data_ts(r,i),o())},setOiShowOnChart(r){n()||(t.set_oi_show_on_chart(r),o())},setOiDisplayMode(r){n()||(t.set_oi_display_mode(r),o())},setOiRatio(r){n()||(t.set_oi_ratio(r),o())},getOiRatio(){if(n())return .2;try{return t.get_oi_ratio()}catch{return .2}},enableFundingRate(){n()||p("fundingRate")&&(t.enable_funding_rate(),o())},disableFundingRate(){n()||(t.disable_funding_rate(),o())},isFundingRateEnabled(){if(n())return!1;try{return t.is_funding_rate_enabled()}catch{return!1}},setFrBinanceData(r,i){n()||(t.set_fr_binance_data(r,i),o())},setFrAggData(r,i){n()||(t.set_fr_agg_data(r,i),o())},setFrShowAgg(r){n()||(t.set_fr_show_agg(r),o())},setFrShowSma(r){n()||(t.set_fr_show_sma(r),o())},enableCvd(){n()||p("cvd")&&(t.enable_cvd(),o())},disableCvd(){n()||(t.disable_cvd(),o())},isCvdEnabled(){if(n())return!1;try{return t.is_cvd_enabled()}catch{return!1}},setCvdData(r,i){n()||(t.set_cvd_data(r,i),o())},setCvdSpotData(r,i){n()||(t.set_cvd_spot_data(r,i),o())},setCvdSource(r){n()||(t.set_cvd_source(r),o())},getCvdSource(){if(n())return 0;try{return t.get_cvd_source()}catch{return 0}},setCvdMode(r){n()||(t.set_cvd_mode(r),o())},getCvdMode(){if(n())return 0;try{return t.get_cvd_mode()}catch{return 0}},setCvdShowDelta(r){n()||(t.set_cvd_show_delta(r),o())},getCvdShowDelta(){if(n())return!0;try{return t.get_cvd_show_delta()}catch{return!0}},setCvdShowSignals(r){n()||(t.set_cvd_show_signals(r),o())},getCvdShowSignals(){if(n())return!0;try{return t.get_cvd_show_signals()}catch{return!0}},setCvdShowDivergence(r){n()||(t.set_cvd_show_divergence(r),o())},getCvdShowDivergence(){if(n())return!1;try{return t.get_cvd_show_divergence()}catch{return!1}},enableLargeTrades(){n()||p("largeTrades")&&(t.enable_large_trades(),o())},disableLargeTrades(){n()||(t.disable_large_trades(),o())},isLargeTradesEnabled(){if(n())return!1;try{return t.is_large_trades_enabled()}catch{return!1}},setLargeTradesData(r){n()||(t.set_large_trades_data(r),o())},pushLargeTrade(r,i,e,a){n()||(t.push_large_trade(r,i,e,a),o())},clearLargeTrades(){n()||(t.clear_large_trades(),o())},setLtVolumeFilter(r,i){n()||(t.set_lt_volume_filter(r,i),o())},setLtBubbleScale(r){n()||(t.set_lt_bubble_scale(r),o())},getLtDataMinVol(){return n()?0:t.get_lt_data_min_vol()},getLtDataMaxVol(){return n()?0:t.get_lt_data_max_vol()},ltHitTest(r,i){if(n())return"";try{return t.lt_hit_test(r,i)}catch{return""}},enableVrvp(){n()||p("vrvp")&&(t.enable_vrvp(),o())},disableVrvp(){n()||(t.disable_vrvp(),o())},isVrvpEnabled(){if(n())return!1;try{return t.is_vrvp_enabled()}catch{return!1}},setVrvpPocLine(r){n()||(t.set_vrvp_poc_line(r),o())},vrvpHitTest(r,i){if(n())return"";try{return t.vrvp_hit_test(r,i)}catch{return""}},enableTpo(){n()||p("tpo")&&(t.enable_tpo(),o())},disableTpo(){n()||(t.disable_tpo(),o())},isTpoEnabled(){if(n())return!1;try{return t.is_tpo_enabled()}catch{return!1}},setTpoPocLine(r){n()||(t.set_tpo_poc_line(r),o())},setTpoVaLines(r){n()||(t.set_tpo_va_lines(r),o())},setTpoIb(r){n()||(t.set_tpo_ib(r),o())},setTpoSinglePrints(r){n()||(t.set_tpo_single_prints(r),o())},setTpoPeriod(r){n()||(t.set_tpo_period(r),o())},getTpoPeriod(){if(n())return 1440;try{return t.get_tpo_period()}catch{return 1440}},setTpoNakedPoc(r){n()||(t.set_tpo_naked_poc(r),o())},setTpoProfileShape(r){n()||(t.set_tpo_profile_shape(r),o())},setTpoIbMinutes(r){n()||(t.set_tpo_ib_minutes(r),o())},setTpoLetterMinutes(r){n()||(t.set_tpo_letter_minutes(r),o())},setTpoSignals(r){n()||(t.set_tpo_signals(r),o())},isTpoSignals(){if(n())return!1;try{return t.is_tpo_signals()}catch{return!1}},enableLiqHeatmap(){n()||p("liqHeatmap")&&(t.enable_liq_heatmap(),o())},disableLiqHeatmap(){n()||(t.disable_liq_heatmap(),o())},isLiqHeatmapEnabled(){if(n())return!1;try{return t.is_liq_heatmap_enabled()}catch{return!1}},setLiqHeatmapRange(r,i){n()||(t.set_liq_heatmap_range(r,i),o())},getLiqHeatmapMin(){if(n())return 0;try{return t.get_liq_heatmap_min()}catch{return 0}},getLiqHeatmapMax(){if(n())return 1;try{return t.get_liq_heatmap_max()}catch{return 1}},getLiqHeatmapSegMax(){if(n())return 0;try{return t.get_liq_heatmap_seg_max()}catch{return 0}},setLiqHeatmapProfile(r){n()||(t.set_liq_heatmap_profile(r),o())},isLiqHeatmapProfile(){if(n())return!0;try{return t.is_liq_heatmap_profile()}catch{return!0}},setLiqHeatmapCellHeight(r){n()||(t.set_liq_heatmap_cell_height(r),o())},getLiqHeatmapCellHeight(){if(n())return 1;try{return t.get_liq_heatmap_cell_height()}catch{return 1}},setLiqHeatmapPredictions(r){n()||(t.set_liq_heatmap_predictions(r),o())},setLiqHeatmapFilledPct(r){n()||(t.set_liq_heatmap_filled_pct(r),o())},getLiqHeatmapFilledPct(){if(n())return .85;try{return t.get_liq_heatmap_filled_pct()}catch{return .85}},liqHeatmapHitTest(r,i){if(n())return"";try{return t.liq_heatmap_hit_test(r,i)}catch{return""}},liqZoneHitTest(r,i){if(n())return"";try{return t.liq_zone_hit_test(r,i)}catch{return""}},enableSmartRanges(){n()||p("smartRanges")&&(t.enable_smart_ranges(),o())},disableSmartRanges(){n()||(t.disable_smart_ranges(),o())},isSmartRangesEnabled(){if(n())return!1;try{return t.is_smart_ranges_enabled()}catch{return!1}},setSrTextSize(r){n()||(t.set_sr_text_size(r),o())},setSrShowOb(r){n()||(t.set_sr_show_ob(r),o())},setSrObLast(r){n()||(t.set_sr_ob_last(r),o())},setSrShowObActivity(r){n()||(t.set_sr_show_ob_activity(r),o())},setSrShowBreakers(r){n()||(t.set_sr_show_breakers(r),o())},setSrMitigation(r){n()||(t.set_sr_mitigation(r),o())},setSrShowMetrics(r){n()||(t.set_sr_show_metrics(r),o())},setSrShowHtfOb(r){n()||(t.set_sr_show_htf_ob(r),o())},setSrHtfMinutes(r){n()||(t.set_sr_htf_minutes(r),o())},setSrShowFvg(r){n()||(t.set_sr_show_fvg(r),o())},setSrFvgTheme(r){n()||(t.set_sr_fvg_theme(r),o())},setSrFvgMitigation(r){n()||(t.set_sr_fvg_mitigation(r),o())},setSrFvgHtf(r){n()||(t.set_sr_fvg_htf(r),o())},setSrFvgExtend(r){n()||(t.set_sr_fvg_extend(r),o())},setSrShowObSignals(r){n()||(t.set_sr_show_ob_signals(r),o())},setSrShowPredict(r){n()||(t.set_sr_show_predict(r),o())},setSrShowFvgSignals(r){n()||(t.set_sr_show_fvg_signals(r),o())},setSrShowSmartRev(r){n()||(t.set_sr_show_smart_rev(r),o())},setSrSmartRevHtf(r){n()||(t.set_sr_smart_rev_htf(r),o())},setSrStatsType(r){n()||(t.set_sr_stats_type(r),o())},setSrStatsPosition(r){n()||(t.set_sr_stats_position(r),o())},getSrSignalsCount(){if(n())return 0;try{return t.get_sr_signals_count()}catch{return 0}},enableEmaStructure(){n()||p("emaStructure")&&(t.enable_ema_structure(),o())},disableEmaStructure(){n()||(t.disable_ema_structure(),o())},isEmaStructureEnabled(){if(n())return!1;try{return t.is_ema_structure_enabled()}catch{return!1}},setEsEma1Len(r){n()||(t.set_es_ema1_len(r),o())},setEsEma2Len(r){n()||(t.set_es_ema2_len(r),o())},setEsWmaLen(r){n()||(t.set_es_wma_len(r),o())},setEsShowEma1(r){n()||(t.set_es_show_ema1(r),o())},setEsShowEma2(r){n()||(t.set_es_show_ema2(r),o())},setEsShowWma(r){n()||(t.set_es_show_wma(r),o())},setEsSwingLen(r){n()||(t.set_es_swing_len(r),o())},setEsShowBos(r){n()||(t.set_es_show_bos(r),o())},enableLiveSignals(){n()||(t.enable_live_signals(),o())},disableLiveSignals(){n()||(t.disable_live_signals(),o())},isLiveSignalsEnabled(){if(n())return!1;try{return t.is_live_signals_enabled()}catch{return!1}},setLiveSignalsData(r){n()||(t.set_live_signals_data(new Float64Array(r)),o())},clearLiveSignals(){n()||(t.clear_live_signals(),o())},setLiveSignalsLeverage(r){n()||(t.set_live_signals_leverage(r),o())},getLiveSignalsLeverage(){if(n())return 10;try{return t.get_live_signals_leverage()}catch{return 10}},setLiveSignalsTrial(r){n()||(t.set_live_signals_trial(r),o())},setLiveSignalsShowEntry(r){n()||(t.set_live_signals_show_entry(r),o())},setLiveSignalsShowTpSl(r){n()||(t.set_live_signals_show_tp_sl(r),o())},setLiveSignalsShowMaxProfit(r){n()||(t.set_live_signals_show_max_profit(r),o())},setLiveSignalsShowLabels(r){n()||(t.set_live_signals_show_labels(r),o())},setLiveSignalsShowZones(r){n()||(t.set_live_signals_show_zones(r),o())},setLiveSignalsTextSize(r){n()||(t.set_live_signals_text_size(r),o())},setLiveSignalsPipValue(r){n()||(t.set_live_signals_pip_value(r),o())},setLiveSignalsLoading(r){n()||(t.set_live_signals_loading(r),o())},getLiveSignalsCount(){if(n())return 0;try{return t.get_live_signals_count()}catch{return 0}},enableVpin(){n()||p("vpin")&&(t.enable_vpin(),o())},disableVpin(){n()||(t.disable_vpin(),o())},isVpinEnabled(){if(n())return!1;try{return t.is_vpin_enabled()}catch{return!1}},setVpinData(r,i){n()||(t.set_vpin_data(r,i),o())},setVpinBucketSize(r){n()||(t.set_vpin_bucket_size(r),o())},getVpinBucketSize(){if(n())return 50;try{return t.get_vpin_bucket_size()}catch{return 50}},setVpinNumBuckets(r){n()||(t.set_vpin_num_buckets(r),o())},getVpinNumBuckets(){if(n())return 50;try{return t.get_vpin_num_buckets()}catch{return 50}},setVpinThreshold(r){n()||(t.set_vpin_threshold(r),o())},getVpinThreshold(){if(n())return .7;try{return t.get_vpin_threshold()}catch{return .7}},setVpinShowSma(r){n()||(t.set_vpin_show_sma(r),o())},setVpinShowZones(r){n()||(t.set_vpin_show_zones(r),o())},enableStopIceberg(){n()||p("stopIceberg")&&(t.enable_stop_iceberg(),o())},disableStopIceberg(){n()||(t.disable_stop_iceberg(),o())},isStopIcebergEnabled(){if(n())return!1;try{return t.is_stop_iceberg_enabled()}catch{return!1}},setSiShowStops(r){n()||(t.set_si_show_stops(r),o())},setSiShowIcebergs(r){n()||(t.set_si_show_icebergs(r),o())},setSiShowZones(r){n()||(t.set_si_show_zones(r),o())},setIcebergEvents(r,i,e,a,f,l){n()||(t.set_iceberg_events(r,i,e,a,f,l),o())},getStopRunCount(){if(n())return 0;try{return t.get_stop_run_count()}catch{return 0}},getIcebergCount(){if(n())return 0;try{return t.get_iceberg_count()}catch{return 0}},enableVolume(){t.enable_volume(),o()},disableVolume(){t.disable_volume(),o()},isVolumeEnabled(){return t.is_volume_enabled()},setVolumeMaPeriod(r){t.set_volume_ma_period(r),o()},setVolumeShowMa(r){t.set_volume_show_ma(r),o()},setVolumeShowSignals(r){t.set_volume_show_signals(r),o()},setVolumeColorMode(r){t.set_volume_color_mode(r),o()},getVolumeMaPeriod(){return t.get_volume_ma_period()},getVolumeShowMa(){return t.get_volume_show_ma()},getVolumeShowSignals(){return t.get_volume_show_signals()},getVolumeColorMode(){return t.get_volume_color_mode()}}}function ne(t,o,n,s){let p=i=>s()(i),r=(i,e,a)=>i<=1&&e<=1&&a<=1&&(i>0||e>0||a>0)?[Math.round(i*255),Math.round(e*255),Math.round(a*255)]:[i&255,e&255,a&255];return{addMarker(i,e,a){t.add_marker(i,e,a),o()},clearMarkers(){t.clear_markers(),o()},hitTestMarker(i,e){return t.hit_test_marker(i,e)},selectMarker(i){t.select_marker(i),o()},deselectMarker(){t.deselect_marker(),o()},getSelectedMarker(){return t.get_selected_marker()},removeMarker(i){t.remove_marker(i),o()},deleteSelectedMarker(){let i=t.get_selected_marker();return i>0&&(t.remove_marker(i),o()),i},addTrendline(i,e,a,f,l,g,u,_,c,h=0){let[d,w,m]=r(l,g,u),M=t.add_trendline(i,e,a,f,d,w,m,_,c,h);return o(),M},addHorizontalLine(i,e,a,f,l,g,u,_=0){let[c,h,d]=r(a,f,l),w=t.add_horizontal_line(i,e,c,h,d,g,u,_);return o(),w},addArrow(i,e,a,f,l,g,u,_,c,h=0){let[d,w,m]=r(l,g,u),M=t.add_arrow(i,e,a,f,d,w,m,_,c,h);return o(),M},addFibRetracement(i,e,a,f,l,g,u,_,c,h=0){if(!p("drawingFull"))return 0;let[d,w,m]=r(l,g,u),M=t.add_fib_retracement(i,e,a,f,d,w,m,_,c,h);return o(),M},addFibExtension(i,e,a,f,l,g,u,_,c,h,d,w=0){if(!p("drawingFull"))return 0;let[m,M,I]=r(u,_,c),C=t.add_fib_extension(i,e,a,f,l,g,m,M,I,h,d,w);return o(),C},addLongPosition(i,e,a,f,l,g,u,_,c,h=0){if(!p("drawingFull"))return 0;let[d,w,m]=r(l,g,u),M=t.add_long_position(i,e,a,f,d,w,m,_,c,h);return o(),M},addShortPosition(i,e,a,f,l,g,u,_,c,h=0){if(!p("drawingFull"))return 0;let[d,w,m]=r(l,g,u),M=t.add_short_position(i,e,a,f,d,w,m,_,c,h);return o(),M},addAnchoredVwap(i,e,a,f,l,g,u=0){if(!p("drawingFull"))return 0;let[_,c,h]=r(e,a,f),d=t.add_anchored_vwap(i,_,c,h,l,g,u);return o(),d},addPriceLabel(i,e,a,f,l,g,u=0){let[_,c,h]=r(a,f,l),d=t.add_price_label(i,e,_,c,h,g,u);return o(),d},addElliottImpulse(i,e,a,f,l,g,u=0){if(!p("drawingFull"))return 0;let[_,c,h]=r(a,f,l),d=t.add_elliott_impulse(i,e,_,c,h,g,u);return o(),d},setDrawingFontSize(i,e){t.set_drawing_font_size(i,e),o()},getDrawingFontSize(i){return t.get_drawing_font_size(i)},setDrawingText(i,e){t.set_drawing_text(i,e),o()},getDrawingText(i){return t.get_drawing_text(i)},setDrawingStyle(i,e,a,f,l){let[g,u,_]=r(e,a,f);t.set_drawing_style(i,g,u,_,l),o()},getDrawingColor(i){let e=t.get_drawing_color(i);return e?{r:e>>>24&255,g:e>>>16&255,b:e>>>8&255,lineWidth:(e&255)/10}:null},getDrawingDashed(i){try{return t.get_drawing_dashed(i)}catch{return!1}},setDrawingDashed(i,e){t.set_drawing_dashed(i,e),o()},getDrawingHideLabel(i){try{return t.get_drawing_hide_label(i)}catch{return!1}},setDrawingHideLabel(i,e){t.set_drawing_hide_label(i,e),o()},getDrawingKindId(i){try{return t.get_drawing_kind_id(i)}catch{return 255}},removeDrawing(i){t.remove_drawing(i),o()},clearDrawings(){t.clear_drawings(),o()},drawingCount(){return t.drawing_count()},setDrawingPreview(i,e,a,f,l,g,u,_,c,h,d=0){let[w,m,M]=r(g,u,_);t.set_drawing_preview(i,e,a,f,l,w,m,M,c,h,d),o()},clearDrawingPreview(){t.clear_drawing_preview(),o()},cancelBrush(){t.cancel_brush(),o()},selectDrawing(i){t.select_drawing(i),o()},deselectDrawing(){t.deselect_drawing(),o()},getSelectedDrawing(){return t.get_selected_drawing()},deleteSelectedDrawing(){let i=t.get_selected_drawing();return i>0&&(t.remove_drawing(i),o()),i},exportDrawingsJson(){try{return t.export_drawings_json()}catch{return"[]"}},importDrawingsJson(i){try{t.import_drawings_json(i),o()}catch(e){console.warn("[bridge] importDrawingsJson failed",e)}},screenToWorld(i,e){return{x:t.screen_to_world_x(i),y:t.screen_to_world_y(e)}},worldToScreen(i,e){try{return{x:t.world_to_screen_x(i),y:t.world_to_screen_y(e)}}catch{return null}}}}var N=t=>t instanceof Float64Array?t:new Float64Array(t);function ie(t,o,n,s){let p=r=>s()(r);return{setKlines(r,i,e,a,f,l){t.set_klines(N(r),N(i),N(e),N(a),N(f),N(l)),o()},setRealTimestamps(r){t.set_real_timestamps(N(r)),o()},appendRealTimestamp(r){t.append_real_timestamp(r)},prependKlines(r,i,e,a,f,l){t.prepend_klines(N(r),N(i),N(e),N(a),N(f),N(l)),o()},appendKline(r,i,e,a,f,l){t.append_kline(r,i,e,a,f,l),o()},updateLastKline(r,i,e,a,f,l){t.update_last_kline(r,i,e,a,f,l),o()},popLastKline(){let r=t.pop_last_kline();return r&&o(),r},getLastClose(){try{return t.get_last_close()}catch{return 0}},getKlineCount(){if(n())return 0;try{return t.kline_count()}catch{return 0}},getKlineTimestamps(){if(n())return null;try{return t.kline_timestamps()}catch{return null}},getKlineOpens(){if(n())return null;try{return t.kline_opens()}catch{return null}},getKlineHighs(){if(n())return null;try{return t.kline_highs()}catch{return null}},getKlineLows(){if(n())return null;try{return t.kline_lows()}catch{return null}},getKlineCloses(){if(n())return null;try{return t.kline_closes()}catch{return null}},getKlineVolumes(){if(n())return null;try{return t.kline_volumes()}catch{return null}},setHeatmap(r,i,e,a,f,l,g){p("heatmap")&&(t.set_heatmap(N(r),i,e,a,f,l,g),o())},appendHeatmapColumn(r,i,e,a){p("heatmap")&&(t.append_heatmap_column(N(r),i,e,a),o())},updateLastHeatmapColumn(r,i,e){t.update_last_heatmap_column(N(r),i,e),o()},getHeatmapLastTimestamp(){try{return t.get_heatmap_last_timestamp()}catch{return 0}},getHeatmapXStep(){try{return t.get_heatmap_x_step()}catch{return 0}},updateHeatmapColumnAt(r,i,e,a){t.update_heatmap_column_at(N(r),i,e,a),o()},setHeatmapRange(r,i){t.set_heatmap_range(r,i),o()},getHeatmapDataRange(){try{return{min:t.get_heatmap_data_min(),max:t.get_heatmap_data_max()}}catch{return{min:0,max:0}}},setHeatmapPrefetchRange(r){try{t.set_heatmap_prefetch_range(r)}catch{}},clearHeatmapPrefetchRange(){try{t.clear_heatmap_prefetch_range()}catch{}},getHeatmapPrefetchMax(){try{return t.get_heatmap_prefetch_max()}catch{return 0}},setChartType(r){n()||r===2&&!p("footprint")||(t.set_chart_type(r),o())},getChartType(){if(n())return 0;try{return t.get_chart_type()}catch{return 0}},setFootprintTickSize(r){n()||p("footprint")&&(t.set_footprint_tick_size(r),o())},footprintEnsureLen(r){n()||t.footprint_ensure_len(r)},footprintAddTrade(r,i,e,a){n()||t.footprint_add_trade(r,i,e,a)},footprintAddTradeBatch(r){n()||!r||r.length===0||t.footprint_add_trade_batch(N(r))},footprintSetBar(r,i,e,a,f){n()||(t.footprint_set_bar(r,i,e,a,f),o())},footprintClear(){n()||(t.footprint_clear(),o())},footprintClearBar(r){n()||t.footprint_clear_bar(r)},footprintPrependEmpty(r){n()||t.footprint_prepend_empty(r)},footprintSetShowSignals(r){n()||(t.footprint_set_show_signals(r),o())},footprintGetShowSignals(){if(n())return!0;try{return t.footprint_get_show_signals()}catch{return!0}},footprintSignalCount(){if(n())return 0;try{return t.footprint_signal_count()}catch{return 0}},footprintSetShowProfile(r){n()||(t.footprint_set_show_profile(r),o())},footprintGetShowProfile(){if(n())return!1;try{return t.footprint_get_show_profile()}catch{return!1}},footprintProfileHitTest(r,i){if(n())return"";try{return t.footprint_profile_hit_test(r,i)}catch{return""}},footprintSetDisplayMode(r){n()||(t.footprint_set_display_mode(r),o())},footprintGetDisplayMode(){if(n())return 0;try{return t.footprint_get_display_mode()}catch{return 0}},enableDeltaHistogram(){n()||t.enable_delta_histogram()},disableDeltaHistogram(){n()||t.disable_delta_histogram()},deltaHistogramEnabled(){if(n())return!1;try{return t.delta_histogram_enabled()}catch{return!1}}}}var Fe=1;function j(t){if(typeof t!="string")return{r:255,g:255,b:255,a:153};if(t.startsWith("#")){let n=t.slice(1);if(n.length===8)return{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16),a:parseInt(n.slice(6,8),16)};let s=parseInt(n.slice(0,2),16),p=parseInt(n.slice(2,4),16),r=parseInt(n.slice(4,6),16);return{r:s,g:p,b:r,a:255}}let o=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\)/);return o?{r:+o[1],g:+o[2],b:+o[3],a:o[4]!==void 0?Math.round(+o[4]*255):255}:{r:255,g:255,b:255,a:153}}function jt(t,o,n){let s=new Map,p=null,r=0,i=NaN;function e(){let u;try{u=t.kline_count()}catch{return p}if(u===0)return null;let _=t.kline_closes(),c=_?.[u-1]??NaN;if(p&&!(u!==r||c!==i))return p;try{let d=t.kline_timestamps(),w=t.kline_opens(),m=t.kline_highs(),M=t.kline_lows(),I=t.kline_volumes();if(!d||!_)return p;p={timestamps:Array.from(d),open:Array.from(w),high:Array.from(m),low:Array.from(M),close:Array.from(_),volume:Array.from(I),length:u},r=u,i=c;for(let C of s.values())C._needsCompute=!0}catch{}return p}function a(){return{seriesLine(u,_="#ffffff99",c=1.5){let h=j(_);t.custom_series_line(new Float64Array(u),h.r,h.g,h.b,h.a,c)},seriesDashedLine(u,_="#ffffff66",c=1,h=4,d=4){let w=j(_);t.custom_series_dashed_line(new Float64Array(u),w.r,w.g,w.b,w.a,c,h,d)},band(u,_,c="rgba(100,149,237,0.08)"){let h=j(c);t.custom_band(new Float64Array(u),new Float64Array(_),h.r,h.g,h.b,h.a)},hline(u,_="#ffffff66",c=1){let h=j(_);t.custom_hline(u,h.r,h.g,h.b,h.a,c)},dashedHline(u,_="#ffffff66",c=1,h=6,d=4){let w=j(_);t.custom_dashed_hline(u,w.r,w.g,w.b,w.a,c,h,d)},marker(u,_,c="#e8a04a",h=3){let d=j(c);t.custom_marker(u,_,d.r,d.g,d.b,d.a,h)},markerUp(u,_,c="#26a69a",h=5){let d=j(c);t.custom_marker_up(u,_,d.r,d.g,d.b,d.a,h)},markerDown(u,_,c="#ef5350",h=5){let d=j(c);t.custom_marker_down(u,_,d.r,d.g,d.b,d.a,h)},text(u,_,c,h="#ffffffaa",d=10,w="center"){let m=j(h),M=w==="center"?1:w==="right"?2:0;t.custom_text(u,_,c,m.r,m.g,m.b,m.a,d,M)},priceLabel(u,_,c="#ffffffaa",h=10){let d=j(c);t.custom_price_label(u,_,d.r,d.g,d.b,d.a,h)},linePx(u,_,c,h,d,w=1){let m=j(d);t.custom_line_px(u,_,c,h,m.r,m.g,m.b,m.a,w)},fillRectPx(u,_,c,h,d){let w=j(d);t.custom_fill_rect_px(u,_,c,h,w.r,w.g,w.b,w.a)},strokeRectPx(u,_,c,h,d,w=1){let m=j(d);t.custom_stroke_rect_px(u,_,c,h,m.r,m.g,m.b,m.a,w)},textPx(u,_,c,h,d=10,w="left"){let m=j(h),M=w==="center"?1:w==="right"?2:0;t.custom_text_px(u,_,c,m.r,m.g,m.b,m.a,d,M)},worldToScreenX:u=>t.world_to_screen_x(u),worldToScreenY:u=>t.world_to_screen_y(u),screenToWorldX:u=>t.screen_to_world_x(u),screenToWorldY:u=>t.screen_to_world_y(u),chartArea:()=>({x:t.chart_area_x(),y:t.chart_area_y(),w:t.chart_area_w(),h:t.chart_area_h()})}}function f(u){if(!u.compute)return;let _=e();if(_)try{u._computed=u.compute(_,u.params)||{}}catch(c){console.warn(`[CustomIndicator "${u.name}"] compute error:`,c),u._computed={}}}function l(u){if(s.size===0)return;let _=e();if(!_)return;t.custom_begin();let c=a();for(let d of s.values())if(d.enabled){d._needsCompute&&(f(d),d._needsCompute=!1);try{d.render.call(d,c,d._computed||{},_)}catch(w){console.warn(`[CustomIndicator "${d.name}"] render error:`,w)}}if(t.custom_end(),t.custom_command_count()>0){let d=t.get_custom_buffer_ptr(),w=t.get_custom_buffer_len();n(u,o,d,w)}}function g(){p=null,r=0,i=NaN;for(let u of s.values())u._needsCompute=!0}return{add(u){let _=Fe++,c={id:_,name:u.name||`Custom ${_}`,params:{...u.params},compute:u.compute||null,render:u.render,enabled:!0,_computed:{},_needsCompute:!0};return s.set(_,c),_},remove(u){s.delete(u)},updateParams(u,_){let c=s.get(u);c&&(Object.assign(c.params,_),c._needsCompute=!0)},setEnabled(u,_){let c=s.get(u);c&&(c.enabled=_)},list(){return[...s.values()].map(u=>({id:u.id,name:u.name,params:{...u.params},enabled:u.enabled}))},invalidateCompute:g,renderAll:l}}var ae={trial:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!0,tpo:!0,smartRanges:!0,emaStructure:!0,customIndicators:!0,forexSignals:!0,vpin:!0,stopIceberg:!0},standard:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!1,heatmap:!1,footprint:!1,liqHeatmap:!1,oi:!1,fundingRate:!1,cvd:!1,largeTrades:!1,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1,vpin:!1,stopIceberg:!1},professional:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1,vpin:!1,stopIceberg:!1},enterprise:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!0,tpo:!0,smartRanges:!0,emaStructure:!0,customIndicators:!0,forexSignals:!0,vpin:!0,stopIceberg:!0}},Ze={rsi:"RSI",drawingBasic:"Basic Drawing Tools",heatmap:"Orderbook Heatmap",footprint:"Footprint Chart",liqHeatmap:"Liquidation Heatmap",oi:"Open Interest",fundingRate:"Funding Rate",cvd:"CVD",largeTrades:"Large Trades",vrvp:"VRVP",tpo:"TPO / Market Profile",smartRanges:"Smart Ranges",emaStructure:"EMA Structure",drawingFull:"All Drawing Tools",customIndicators:"Custom Indicators",forexSignals:"Forex Signals",vpin:"VPIN",stopIceberg:"Stops & Icebergs"},ze={rsi:"Standard",drawingBasic:"Standard",heatmap:"Professional",footprint:"Professional",liqHeatmap:"Professional",oi:"Professional",fundingRate:"Professional",cvd:"Professional",largeTrades:"Professional",drawingFull:"Professional",vrvp:"Enterprise",tpo:"Enterprise",smartRanges:"Enterprise",emaStructure:"Enterprise",customIndicators:"Enterprise",forexSignals:"Enterprise",vpin:"Enterprise",stopIceberg:"Enterprise"};function nt(t){return ae[t]||ae.trial}function Ft(t){let o=nt(t),n=new Set;return function(p){if(o[p])return!0;if(!n.has(p)){n.add(p);let r=Ze[p]||p,i=ze[p]||"a higher";console.warn(`[MRD Chart Engine] "${r}" requires ${i} plan. Current plan: ${t}. Upgrade at https://mrd-chart.dev/pricing`)}return!1}}var De=14,le="trial",ct="free";var zt=[95,95,109,114].map(t=>String.fromCharCode(t)).join(""),Xe=1297237059;function de(t){let o=`${t}:${Xe}:${(t^2043453)>>>0}`,n=2166136261;for(let s=0;s<o.length;s++)n^=o.charCodeAt(s),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function ht(t){return`${t}.${de(t)}`}function pt(t){if(!t||typeof t!="string")return null;let o=t.lastIndexOf(".");if(o<1)return null;let n=parseInt(t.slice(0,o),10);return!n||n<1e9||n>2e9||t.slice(o+1)!==de(n)?null:n}var ce=zt+"e7x",he=zt+"p3q",pe="mrd_engine_session_id",we="mrd_ce_db",it="meta",ge="trial_ts",me=zt+"ck";function Dt(){try{return pt(localStorage.getItem(ce))}catch{return null}}function Xt(t){try{localStorage.setItem(ce,ht(t))}catch{}}function Ot(){try{return pt(localStorage.getItem(he))}catch{return null}}function Ht(t){try{localStorage.setItem(he,ht(t))}catch{}}function Vt(){try{return pt(sessionStorage.getItem(pe))}catch{return null}}function Wt(t){try{sessionStorage.setItem(pe,ht(t))}catch{}}function Bt(){try{let t=document.cookie.match(new RegExp(`(?:^|;\\s*)${me}=([^;]+)`));return t?pt(decodeURIComponent(t[1])):null}catch{return null}}function Gt(t){try{let o=encodeURIComponent(ht(t));document.cookie=`${me}=${o};path=/;max-age=${86400*400};SameSite=Lax`}catch{}}var at=null,ue=!1;function Oe(){if(!(ue||typeof indexedDB>"u")){ue=!0;try{let t=indexedDB.open(we,1);t.onupgradeneeded=()=>{let o=t.result;o.objectStoreNames.contains(it)||o.createObjectStore(it)},t.onsuccess=()=>{let s=t.result.transaction(it,"readonly").objectStore(it).get(ge);s.onsuccess=()=>{let p=pt(s.result);p&&(!at||p<at)&&(at=p,He(p))}}}catch{}}}function Me(t){at=t;try{let o=indexedDB.open(we,1);o.onsuccess=()=>{o.result.transaction(it,"readwrite").objectStore(it).put(ht(t),ge)}}catch{}}function He(t){let o=Math.floor(Date.now()/1e3),n=Se([Dt(),Ot(),Vt(),Bt(),t],o);n&&n!==t||n&&(Xt(n),Ht(n),Wt(n),Gt(n))}function Se(t,o){let n=null;for(let s of t)s&&(s>o+60||s<17e8||(!n||s<n)&&(n=s));return n}function Ve(){let t=Math.floor(Date.now()/1e3),o=[Dt(),Ot(),Vt(),Bt(),at];return Se(o,t)}function We(t){Xt(t),Ht(t),Wt(t),Gt(t),Me(t)}function Be(t){Dt()||Xt(t),Ot()||Ht(t),Vt()||Wt(t),Bt()||Gt(t),at||Me(t)}Oe();function Ct(t){if(!t||t==="trial")return Ge();try{let o=JSON.parse(atob(t)),{p:n,d:s,e:p,s:r}=o;if(!n||!r)return{valid:!1,error:"Invalid license key format"};let i={...o};if(delete i.s,r!==Ie(i))return{valid:!1,error:"Invalid license key signature"};if(p>0&&Date.now()/1e3>p)return{valid:!0,plan:ct,watermark:!0,trialExpired:!0,originalPlan:n,error:`License expired on ${new Date(p*1e3).toLocaleDateString()}`,features:nt(ct)};let e=o.pl||"web";if((e==="web"||e==="any")&&s&&s!=="*"&&typeof window<"u"){let a=window.location.hostname;if(a&&a!=="localhost"&&a!=="127.0.0.1"&&a!=="0.0.0.0"&&a!==""&&!s.split(",").map(g=>g.trim()).some(g=>qe(g,a)))return{valid:!1,error:`License not valid for domain: ${a}`}}if(e==="mobile"&&o.a&&typeof window<"u"){let a=window.__mrd_app_id;if(a&&a!==o.a)return{valid:!1,error:`License not valid for app: ${a}`}}return{valid:!0,plan:n,domain:s,platform:e,appId:o.a||null,expiry:p,watermark:!1,features:nt(n)}}catch{return{valid:!1,error:"Invalid license key"}}}function Ie(t){let o="mrd-ce-hmac-2024-x9k2m",n=JSON.stringify(t),s=o+":"+n,p=2166136261,r=1818371886,i=3735928559;for(let e=0;e<s.length;e++){let a=s.charCodeAt(e);p=Math.imul(p^a,16777619)>>>0,r=Math.imul(r^a,1540483477)>>>0,i=Math.imul(i^a,461845907)>>>0}return(p.toString(36)+r.toString(36)+i.toString(36)).slice(0,24)}function Ge(){let t=Ve();t?Be(t):(t=Math.floor(Date.now()/1e3),We(t));let o=t+De*86400,n=Date.now()/1e3,s=Math.max(0,Math.ceil((o-n)/86400));return n>o?{valid:!0,plan:ct,watermark:!0,trialExpired:!0,daysLeft:0,features:nt(ct)}:{valid:!0,plan:le,watermark:!1,daysLeft:s,trialEnd:o,features:nt(le)}}function qe(t,o){if(t==="*"||t===o)return!0;if(t.startsWith("*.")){let n=t.slice(1);return o.endsWith(n)||o===t.slice(2)}return!1}var Ke="MRD-Indicators",fe="mrd-indicators.com",Ue="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCAzMCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNCk7CiAgICAgIH0KCiAgICAgIC5jbHMtMiB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtMik7CiAgICAgIH0KCiAgICAgIC5jbHMtMiwgLmNscy0zLCAuY2xzLTQsIC5jbHMtNSwgLmNscy02IHsKICAgICAgICBtaXgtYmxlbmQtbW9kZTogbXVsdGlwbHk7CiAgICAgIH0KCiAgICAgIC5jbHMtMyB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtMyk7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNik7CiAgICAgIH0KCiAgICAgIC5jbHMtNSB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNSk7CiAgICAgIH0KCiAgICAgIC5jbHMtNiB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNyk7CiAgICAgIH0KCiAgICAgIC5jbHMtNyB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQpOwogICAgICB9CgogICAgICAuY2xzLTggewogICAgICAgIGlzb2xhdGlvbjogaXNvbGF0ZTsKICAgICAgfQogICAgPC9zdHlsZT4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50IiB4MT0iOS4xMiIgeTE9IjE1Ljg4IiB4Mj0iMTkuNjMiIHkyPSI1LjM3IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2IzNTA5ZSIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmNWE0YzciLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC0yIiB4MT0iOS4wOCIgeTE9IjYuODEiIHgyPSI5LjA4IiB5Mj0iMTQuNzMiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjMjM0ZmIzIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2ZmZiIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTMiIHgxPSIxNy42NyIgeTE9IjYuMTEiIHgyPSI4LjQxIiB5Mj0iNi4xMSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM1YTJhOGIiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZmIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNCIgeDE9IjIwLjAzIiB5MT0iMTUuODkiIHgyPSIxMC45OCIgeTI9IjE1Ljg5IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2Y2YWFjYiIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM3NzJhOGQiLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC01IiB4MT0iMTkuMDMiIHkxPSIxNi44MiIgeDI9IjE0Ljc5IiB5Mj0iMTIuNTgiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2VkMzQ4ZCIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTYiIHgxPSIxNS4yNyIgeTE9IjE1LjA2IiB4Mj0iMTUuMjciIHkyPSIxOS4zNyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmYiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZWU0YzliIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNyIgeDE9IjUuNTEiIHkxPSItMTI4LjAyIiB4Mj0iLTMuNyIgeTI9Ii0xMjguMDIiIGdyYWRpZW50VHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEwOS4xMiAxMC4wMSkgcm90YXRlKDg5LjYpIiB4bGluazpocmVmPSIjbGluZWFyLWdyYWRpZW50LTMiLz4KICA8L2RlZnM+CiAgPGcgY2xhc3M9ImNscy04IiBpZD0iTG9nbyI+CiAgICA8ZyBpZD0iT0JKRUNUUyIgPgogICAgICA8ZyBpZCA9IkxvZ28iPiAKICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTciIGQ9Ik00LjIzLDExYzAsNS4zNiw0LjM3LDkuNzEsOS43Niw5LjcxczkuNzYtNC4zNSw5Ljc2LTkuNzFTMTkuMzksMS4yOSwxNCwxLjI5LDQuMjMsNS42NCw0LjIzLDExWk0xMC4yNiwxMC4wN2MwLTEuNTQsMS4yNS0yLjc4LDIuOC0yLjc4aDEuODdjMS41NSwwLDIuOCwxLjI1LDIuOCwyLjc4djEuODZjMCwxLjU0LTEuMjUsMi43OC0yLjgsMi43OGgtMS4yMmMtLjQ1LDAtLjg4LjE1LTEuMjIuNDRsLTIuMjMsMS44NHYtNi45MloiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik0xMC4yNiwxNi45OXYtNi45MnMwLS4wMiwwLS4wM2MuMDItMS41MiwxLjI2LTIuNzUsMi44LTIuNzVoLTUuMDljLTIuMDUsMC0zLjczLDEuNjQtMy43NCwzLjY4LDAsLjAxLDAsLjAzLDAsLjA0LDAsLjA4LDAsLjE2LDAsLjI0LDAsLjA0LDAsLjA4LDAsLjEyLDAsLjA0LDAsLjA4LDAsLjEyLDAsLjA2LDAsLjExLjAxLjE3LDAsLjAyLDAsLjA1LDAsLjA3LDAsLjA2LjAxLjEzLjAyLjE5LDAsLjAxLDAsLjAzLDAsLjA0LDAsLjA3LjAxLjE0LjAyLjIxLDAsMCwwLC4wMSwwLC4wMiwwLC4wNy4wMi4xNS4wMy4yMiwwLDAsMCwwLDAsMCwuNjgsNC42OCw0LjcxLDguMjcsOS42LDguMy0yLjA0LS4wMi0zLjY3LTEuNjktMy42Ny0zLjcyWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTE0LjA0LDEuMjlzLS4wMywwLS4wNCwwYy0uMDgsMC0uMTYsMC0uMjQsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDYsMC0uMTEsMC0uMTcsMC0uMDIsMC0uMDUsMC0uMDcsMC0uMDYsMC0uMTMuMDEtLjE5LjAyLS4wMSwwLS4wMywwLS4wNCwwLS4wNywwLS4xNC4wMS0uMjEuMDIsMCwwLS4wMSwwLS4wMiwwLS4wNywwLS4xNS4wMi0uMjIuMDMsMCwwLDAsMCwwLDAtNC43LjY4LTguMzIsNC42OS04LjM1LDkuNTQuMDItMi4wMiwxLjctMy42NSwzLjc0LTMuNjVoNi45NnMuMDIsMCwuMDMsMGMxLjUzLjAyLDIuNzcsMS4yNiwyLjc3LDIuNzh2LTUuMDZjMC0yLjA0LTEuNjUtMy43MS0zLjctMy43MloiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNC45MywxNC43MWg1LjA5YzIuMDQsMCwzLjcyLTEuNjMsMy43NC0zLjY1LS4wMyw0Ljg2LTMuNjUsOC44Ny04LjM1LDkuNTQsMCwwLDAsMCwwLDAtLjA3LjAxLS4xNS4wMi0uMjIuMDMsMCwwLS4wMSwwLS4wMiwwLS4wNywwLS4xNC4wMi0uMjEuMDItLjAxLDAtLjAzLDAtLjA0LDAtLjA2LDAtLjEzLjAxLS4xOS4wMi0uMDIsMC0uMDUsMC0uMDcsMC0uMDYsMC0uMTEsMC0uMTcsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDgsMC0uMTYsMC0uMjQsMC0uMDEsMC0uMDMsMC0uMDQsMC0yLjA1LDAtMy43LTEuNjgtMy43LTMuNzJsMi4yMy0xLjg0Yy4zNC0uMjguNzgtLjQ0LDEuMjItLjQ0aDEuMjJaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy01IiBkPSJNMTQuOTMsMTQuNzFoNS4wOWMyLjA0LDAsMy43Mi0xLjYzLDMuNzQtMy42NS0uMDMsNC44Ni0zLjY1LDguODctOC4zNSw5LjU0LDAsMCwwLDAsMCwwLS4wNy4wMS0uMTUuMDItLjIyLjAzLDAsMC0uMDEsMC0uMDIsMC0uMDcsMC0uMTQuMDItLjIxLjAyLS4wMSwwLS4wMywwLS4wNCwwLS4wNiwwLS4xMy4wMS0uMTkuMDItLjAyLDAtLjA1LDAtLjA3LDAtLjA2LDAtLjExLDAtLjE3LDAtLjA0LDAtLjA4LDAtLjEyLDAtLjA0LDAtLjA4LDAtLjEyLDAtLjA4LDAtLjE2LDAtLjI0LDAtLjAxLDAtLjAzLDAtLjA0LDAtMi4wNSwwLTMuNy0xLjY4LTMuNy0zLjcybDIuMjMtMS44NGMuMzQtLjI4Ljc4LS40NCwxLjIyLS40NGgxLjIyWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtNCIgZD0iTTIwLjI4LDE0LjcxYy0uMDgsMC0uMTcsMC0uMjUsMGgtNi4zMWMtLjQ1LDAtLjg4LjE1LTEuMjIuNDRsLTIuMjMsMS44NGMwLC4wOCwwLC4xNywwLC4yNSwxLjA5LjY1LDIuMzcsMS4wMiwzLjczLDEuMDIsMi42NywwLDUuMDEtMS40Myw2LjI4LTMuNTVaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy02IiBkPSJNMjMuNzcsMTAuOTdzMC0uMDMsMC0uMDRjMC0uMDgsMC0uMTYsMC0uMjQsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDYsMC0uMTEtLjAxLS4xNywwLS4wMiwwLS4wNSwwLS4wNywwLS4wNi0uMDEtLjEzLS4wMi0uMTksMC0uMDEsMC0uMDMsMC0uMDQsMC0uMDctLjAyLS4xNC0uMDItLjIxLDAsMCwwLS4wMSwwLS4wMiwwLS4wNy0uMDItLjE1LS4wMy0uMjIsMCwwLDAsMCwwLDAtLjcxLTQuNjctNC43Ny04LjI0LTkuNjYtOC4yNCwyLjA0LDAsMy42OCwxLjY2LDMuNywzLjY5bC4wNCw1LjA2djEuODZzLjAxLjAyLjAxLjAzYzAsMS41Mi0xLjI1LDIuNzYtMi43OCwyLjc3bDUuMDktLjA0YzIuMDUtLjAxLDMuNzItMS42NiwzLjcxLTMuN1oiLz4KICAgICAgPC9nPgogICAgPC9nPgogIDwvZz4KPC9zdmc+",Zt=null,_e=!1;function Le(){if(Zt||_e)return Zt;_e=!0;let t=new Image;return t.onload=()=>{Zt=t},t.src=Ue,null}function Qe(){return Math.floor(Date.now()/864e5)}function $e(t){let o=(t^2654435769)>>>0;return function(){o=o+1831565813>>>0;let n=Math.imul(o^o>>>15,1|o);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function xe(t,o,n,s,p,r){let i=Le();t.save(),t.setTransform(1,0,0,1,0,0),t.font="bold 10px Inter, system-ui, sans-serif";let e=t.measureText(s);t.font="8px Inter, system-ui, sans-serif";let a=t.measureText(p),f=i?18:0,l=i?14:0,g=7,u=5,_=i?5:0,h=f+_+Math.max(e.width,a.width)+g*2,d=Math.max(l,20)+u*2,w=Math.round(o-h/2),m=Math.round(n-d/2);t.globalAlpha=.45,t.fillStyle=r?"rgba(255,255,255,0.8)":"rgba(18,18,28,0.8)",t.shadowColor=r?"rgba(0,0,0,0.06)":"rgba(0,0,0,0.25)",t.shadowBlur=8,t.shadowOffsetY=1,t.beginPath(),t.roundRect(w,m,h,d,6),t.fill(),t.shadowColor="transparent",t.strokeStyle=r?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.04)",t.lineWidth=.5,t.stroke();let M=w+g,I=m+d/2;i&&(t.globalAlpha=.5,t.drawImage(i,M,I-l/2,f,l),M+=f+_),t.globalAlpha=.5,t.font="bold 10px Inter, system-ui, sans-serif",t.fillStyle=r?"#1a1a2e":"#ededf5",t.textAlign="left",t.textBaseline="alphabetic",t.fillText(s,M,I-1),t.font="8px Inter, system-ui, sans-serif",t.fillStyle=r?"#777790":"#8080a0",t.textBaseline="top",t.fillText(p,M,I+2),t.restore()}function Ce(t,o,n,s){Le();let p=o.width,r=o.height;if(p<100||r<80)return;t.save(),t.setTransform(1,0,0,1,0,0);let i=$e(Qe()),e=100,a=Math.max(p-e*2,60),f=Math.max(r-e*2,40),l=e+i()*a,g=e+i()*f,u=n.trialExpired||n.plan===ct,_=Ke,c=u?`Free \u2014 ${fe}/pricing`:`Trial: ${n.daysLeft||0}d left \u2014 ${fe}`;xe(t,l,g,_,c,s),t.restore()}function Je({plan:t,domain:o="*",expiryDays:n=365,name:s,email:p}){let r=n>0?Math.floor(Date.now()/1e3)+n*86400:0,i={p:t,d:o,e:r,...s?{n:s}:{},...p?{m:p}:{},i:Date.now()};return i.s=Ie(i),btoa(JSON.stringify(i))}var At=null,vt=null,wt=null;async function Ae(){return At||wt||(wt=(async()=>{let t=await import("./chart_engine.js");return await t.default(),vt=t.wasm_memory(),At=t,t})(),wt)}function ke(){!At&&!wt&&Ae().catch(()=>{})}async function tr(t,o={}){o.appId&&typeof window<"u"&&(window.__mrd_app_id=o.appId);let n=o.licenseKey||o.key||null,s=Ct(n);if(!s.valid)if(s.expired)console.warn(`[MRD Chart Engine] ${s.error}. Get a license at https://mrd-chart.dev/pricing`);else throw new Error(`[MRD Chart Engine] ${s.error}`);s.plan==="trial"&&console.info(`[MRD Chart Engine] Trial mode \u2014 ${s.daysLeft} days remaining. Purchase: https://mrd-chart.dev/pricing`);let p=await Ae(),r=window.devicePixelRatio||1,i=t.getBoundingClientRect();(i.width<1||i.height<1)&&(await new Promise(S=>{let L=new ResizeObserver(A=>{for(let b of A)if(b.contentRect.width>0&&b.contentRect.height>0){L.disconnect(),S();return}});L.observe(t.parentElement||t),setTimeout(()=>{L.disconnect(),S()},2e3)}),i=t.getBoundingClientRect());let e=Math.max(i.width,100),a=Math.max(i.height,100);t.width=e*r,t.height=a*r;let f=t.getContext("2d");f.scale(r,r);let l=new p.ChartEngine(e,a);try{let S=s.expired?2:s.watermark?1:0,L=s.daysLeft||0,A=1297237059;A=Math.imul(A,31)+S>>>0,A=Math.imul(A,31)+L>>>0,A=(A^A>>>16)>>>0,A=Math.imul(A,73244475)>>>0,A=(A^A>>>16)>>>0,l.set_license_state(S,L,A)}catch(S){console.warn("[MRD] set_license_state failed:",S.message)}let g=!0,u=null,_=!1,c=!1,h=!1,d=null,w=null,m=0,M=!1,I=!1,y=("ontouchstart"in window||navigator.maxTouchPoints>0)&&window.innerWidth<=1399?33:0;function $(){if(!(!_||c||u)){if(y>0){let S=performance.now()-m;if(S<y){w||(w=setTimeout(()=>{w=null,$()},y-S));return}}u=requestAnimationFrame(Te)}}let T=()=>{g=!0,$()},tt=()=>h,et=null,gt=null,bt=null,E=null,O=null,G=null,W=null,B=null,lt=0,rt=null,qt=null,Tt=0,Et=0,ot=-1,mt=!1,Mt=!1,ve=Yt(t,l,{onDirty:T,onCrosshairMove:(S,L,A)=>{Tt=S,Et=L,ot=A,mt=!0,Mt=!0},onCrosshairHide:()=>{Mt&&(Mt=!1,mt=!0,ot=-1)},drawingApi:S=>{et=S},onDrawingComplete:()=>{gt?.()},onDrawingCancel:()=>{bt?.()},onDrawingSelected:(S,L,A)=>{E?.(S,L,A)},onMarkerSelected:S=>{O?.(S)},onDrawingDblClick:(S,L,A,b,Nt)=>{G?.(S,L,A,b,Nt)},onVrvpHover:(S,L)=>{W?.(S,L)},onLiqAnnotationPin:(S,L)=>{qt?.(S,L)}});function be(){if(!(!mt||I)){if(mt=!1,!Mt){d&&d(null,0,0),B&&B("");return}if(d)if(ot===0||ot===1)try{let S=l.get_tooltip_data();d(S,Tt,Et)}catch{}else d(null,0,0);if(B){let S=performance.now();if(ot===0||ot===1){if(S-lt>=80){lt=S;try{B(l.lt_hit_test(Tt,Et))}catch{}}}else B("")}}}function Te(){if(u=null,!(!_||c||I)){M=!0;try{let S=!1;try{S=g||l.is_dirty()}catch{I=!0;return}if(S){g=!1,m=performance.now();let L=!1;try{if(l.render()>0){let b=l.get_command_buffer_ptr(),Nt=l.get_command_buffer_len();f.save(),f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,t.width,t.height),f.restore(),ft(f,vt,b,Nt),L=!0}try{J.renderAll(f)}catch{}}catch(A){if(L||(g=!0),A instanceof WebAssembly.RuntimeError){I=!0,console.error("[MRD] Engine crashed:",A.message);return}}be();try{rt?.()}catch{}if(s.watermark)try{let A=l.get_theme()===1;Ce(f,t,s,A)}catch{}try{(g||l.is_dirty())&&$()}catch{}}}finally{M=!1}}}let ut=Ft(s.plan),Ee=se(l,T,tt,()=>ut),Ne=ne(l,T,tt,()=>ut),ye=ie(l,T,tt,()=>ut),J=jt(l,vt,ft);return{engine:l,start(){_=!0,c=!1,g=!0,$()},stop(){_=!1,u&&(cancelAnimationFrame(u),u=null),w&&(clearTimeout(w),w=null)},resize(S){if(I||M)return;if(i=t.getBoundingClientRect(),i.width<1||i.height<1){(S||0)<8&&setTimeout(()=>this.resize((S||0)+1),250);return}r=window.devicePixelRatio||1;let L=i.width*r,A=i.height*r;t.width=L,t.height=A,f.setTransform(1,0,0,1,0,0),f.scale(r,r);try{l.resize(i.width,i.height)}catch(b){if(b instanceof WebAssembly.RuntimeError){I=!0;return}throw b}T()},renderSync(){if(I)return 0;try{let S=l.render();if(S>0){let L=l.get_command_buffer_ptr(),A=l.get_command_buffer_len();f.save(),f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,t.width,t.height),f.restore(),ft(f,vt,L,A)}return S}catch(S){return S instanceof WebAssembly.RuntimeError&&(I=!0),0}},setHoverPrice(S){l.set_hover_price(S),T()},clearHoverPrice(){l.clear_hover_price(),T()},hitZone(S,L){return l.hit_zone(S,L)},startDrawing(S,L){et?.setMode(S,L)},cancelDrawing(){et?.setMode(null)},onDrawingComplete(S){gt=S},onDrawingCancel(S){bt=S},onDrawingSelected(S){E=S},onMarkerSelected(S){O=S},onDrawingDblClick(S){G=S},setReplayState(S,L,A){l.set_replay_state(S,L,A),T()},setReplayHovered(S){l.set_replay_hovered(S)},setReplayPreview(S){l.set_replay_preview(S),T()},setPrecision(S){l.set_price_precision(S),T()},setCandleInterval(S){l.set_candle_interval(S)},setTheme(S){let L=S==="light"?1:0;typeof l.set_theme=="function"?(l.set_theme(L),T()):console.warn("[ChartEngine] set_theme not available \u2014 reload page to load updated WASM")},getTheme(){return l.get_theme()===1?"light":"dark"},onTooltip(S){d=S},onVrvpHover(S){W=S},onLtHover(S){B=S},onPostRender(S){rt=S},onLiqAnnotationPin(S){qt=S},pause(){c||(c=!0,u&&(cancelAnimationFrame(u),u=null),w&&(clearTimeout(w),w=null))},resume(){c&&(c=!1,_&&(g=!0,$()))},get isPaused(){return c},destroy(){h=!0,_=!1,c=!1,u&&(cancelAnimationFrame(u),u=null),w&&(clearTimeout(w),w=null),ve();try{l.free()}catch{}},addIndicator(S){if(!ut("customIndicators"))return null;let L=J.add(S);return T(),L},removeIndicator(S){J.remove(S),T()},updateIndicatorParams(S,L){J.updateParams(S,L),T()},setIndicatorEnabled(S,L){J.setEnabled(S,L),T()},listIndicators(){return J.list()},invalidateCustomIndicators(){J.invalidateCompute(),T()},get license(){return{plan:s.plan,valid:s.valid,expired:!!s.expired,watermark:!!s.watermark,daysLeft:s.daysLeft,features:s.features||{}}},setLicenseKey(S){s=Ct(S),!s.valid&&!s.expired&&console.error(`[MRD Chart Engine] ${s.error}`),ut=Ft(s.plan);try{let L=s.expired?2:s.watermark?1:0,A=s.daysLeft||0,b=1297237059;b=Math.imul(b,31)+L>>>0,b=Math.imul(b,31)+A>>>0,b=(b^b>>>16)>>>0,b=Math.imul(b,73244475)>>>0,b=(b^b>>>16)>>>0,l.set_license_state(L,A,b)}catch{}return T(),s.valid},...ye,...Ee,...Ne}}function er(t,o){let{t:n,o:s,h:p,l:r,c:i,v:e}=t,a=i.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let f=[],l=[],g=[],u=[],_=[],c=[],h=Math.round(i[0]/o)*o,d=0;for(let w=0;w<a;w++){d+=e[w];let M=i[w]-h;for(;M>=o;){let I=h,C=h+o;f.push(n[w]),l.push(I),g.push(C),u.push(I),_.push(C),c.push(d),d=0,h=C}for(;-M>=o;){let I=h,C=h-o;f.push(n[w]),l.push(I),g.push(I),u.push(C),_.push(C),c.push(d),d=0,h=C}}return{t:f,o:l,h:g,l:u,c:_,v:c}}function rr(t,o){let{t:n,o:s,h:p,l:r,c:i,v:e}=t,a=i.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let f=[],l=[],g=[],u=[],_=[],c=[],h=s[0],d=p[0],w=r[0],m=0,M=n[0];for(let I=0;I<a;I++)for(d=Math.max(d,p[I]),w=Math.min(w,r[I]),m+=e[I];d-w>=o;){let C=i[I]>=h,y=C?w+o:d-o;if(f.push(M),l.push(h),g.push(d),u.push(w),_.push(y),c.push(m),h=y,d=C?Math.max(p[I],y):y,w=C?y:Math.min(r[I],y),m=0,M=n[I],d-w<o)break}return(m>0||f.length===0)&&(f.push(M),l.push(h),g.push(d),u.push(w),_.push(i[a-1]),c.push(m)),{t:f,o:l,h:g,l:u,c:_,v:c}}function or(t,o){let{t:n,o:s,h:p,l:r,c:i,v:e}=t,a=i.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let f=[],l=[],g=[],u=[],_=[],c=[],h=Math.max(1,Math.round(o));for(let d=0;d<a;d+=h){let w=Math.min(d+h,a),m=-1/0,M=1/0,I=0;for(let C=d;C<w;C++)p[C]>m&&(m=p[C]),r[C]<M&&(M=r[C]),I+=e[C];f.push(n[d]),l.push(s[d]),g.push(m),u.push(M),_.push(i[w-1]),c.push(I)}return{t:f,o:l,h:g,l:u,c:_,v:c}}function sr(t,o){let n=t>1e4?50:t>1e3?10:t>100?1:t>1?.1:.001,s=n*2,p=o<=60?10:o<=300?5:3;return{brickSize:n,rangeSize:s,tickCount:p}}var nr={minRefills:3,hiddenRatio:2,refillWindowMs:1e4,maxTrackedLevels:200,maxEvents:500,decayMs:3e5};function ir(t={}){let o={...nr,...t},n=new Map,s=new Map,p=[],r=0;function i(u){return Math.round(u*1e8)/1e8}function e(u,_,c,h){for(let[d,w]of u){let m=i(d),M=_.get(m);if(!M){_.set(m,{lastVol:w,refills:0,totalConsumed:0,lastRefillTs:h,peakVisible:w});continue}if(w<M.lastVol*.3&&M.lastVol>0){let I=M.lastVol-w;M.totalConsumed+=I,M.lastVol=w;continue}if(w>M.lastVol*1.5&&M.totalConsumed>0)if(h-M.lastRefillTs<o.refillWindowMs){if(M.refills++,M.lastRefillTs=h,M.peakVisible=Math.max(M.peakVisible,w),M.refills>=o.minRefills){let C=M.totalConsumed,y=M.peakVisible;C>=y*o.hiddenRatio&&(p.push({timestamp:h,price:d,visibleSize:y,hiddenSize:C,isBid:c,refillCount:M.refills}),p.length>o.maxEvents&&p.shift(),M.refills=0,M.totalConsumed=0)}}else M.refills=1,M.totalConsumed=0,M.lastRefillTs=h;M.lastVol=w}if(_.size>o.maxTrackedLevels){let d=[..._.entries()];d.sort((m,M)=>m[1].lastRefillTs-M[1].lastRefillTs);let w=d.length-o.maxTrackedLevels;for(let m=0;m<w;m++)_.delete(d[m][0])}}function a(u,_,c){let h=c||Date.now();r=h;let d=u instanceof Map?u:new Map(u.map(([M,I])=>[M,I])),w=_ instanceof Map?_:new Map(_.map(([M,I])=>[M,I]));e(d,n,!0,h),e(w,s,!1,h);let m=h-o.decayMs;for(;p.length>0&&p[0].timestamp<m;)p.shift()}function f(){return p}function l(u){if(!u||p.length===0)return;let _=p.length,c=new Float64Array(_),h=new Float64Array(_),d=new Float64Array(_),w=new Float64Array(_),m=new Uint8Array(_),M=new Uint32Array(_);for(let I=0;I<_;I++){let C=p[I];c[I]=C.timestamp,h[I]=C.price,d[I]=C.visibleSize,w[I]=C.hiddenSize,m[I]=C.isBid?1:0,M[I]=C.refillCount}u.setIcebergEvents(c,h,d,w,m,M)}function g(){n.clear(),s.clear(),p.length=0}return{onOrderbookUpdate:a,getEvents:f,pushToEngine:l,reset:g}}export{rr as buildRange,er as buildRenko,or as buildTick,tr as createChartBridge,jt as createCustomIndicatorManager,ir as createIcebergDetector,ft as dispatchCommands,Je as generateLicenseKey,ke as prefetchWasm,Yt as setupEvents,sr as suggestDefaults,Ct as validateLicense};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kline-orderbook-chart",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Candlestick chart with built-in orderbook heatmap, footprint chart, and liquidation heatmap. Native high-performance engine. 60 fps, zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/mrd-chart-engine.mjs",
|