@guihz/trading-vue-editor-tes 0.0.12 → 0.0.13

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.
@@ -54,6 +54,27 @@ interface IOrderArgs {
54
54
  trail_offset?: number;
55
55
  profit?: number;
56
56
  }
57
+ type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all';
58
+ interface IOrder extends IOrderArgs {
59
+ isMarketPrice?: boolean;
60
+ in_price: number;
61
+ out_price?: number;
62
+ in_time?: number;
63
+ out_time?: number;
64
+ out_comment?: string;
65
+ total_profit?: number;
66
+ max_profit?: number;
67
+ trading_loss?: number;
68
+ place_order_type?: PlaceOrderType;
69
+ isDeal?: boolean;
70
+ hasExit?: boolean;
71
+ active_price?: number;
72
+ trail_stop_price?: number;
73
+ hasOrder?: boolean;
74
+ isMarketPriceLimit?: boolean;
75
+ isMarketPriceStop?: boolean;
76
+ isCancel?: boolean;
77
+ }
57
78
  type CloseEntriesRuleType = 'FIFO' | 'ANY';
58
79
  export default class Strategy {
59
80
  private _variables;
@@ -64,7 +85,6 @@ export default class Strategy {
64
85
  private _orders;
65
86
  private _pendingOrders;
66
87
  private _mintick;
67
- private _ocaMap;
68
88
  private _funcOptions;
69
89
  constructor(variables: BuiltInVariables, options: IKeyObjectValue, mintick?: number);
70
90
  updateOptions(options: IStrategy): void;
@@ -79,11 +99,20 @@ export default class Strategy {
79
99
  entry(args: IOrderArgs): void;
80
100
  private _entryHandle;
81
101
  private _entryOrder;
102
+ private _getEntryOrders;
82
103
  private _addPendingEntry;
104
+ close(args: IOrder): void;
105
+ close_all(args: IOrder): void;
106
+ private _closeAllOrders;
107
+ private _closeOrders;
108
+ cancel({ id }: {
109
+ id: string;
110
+ }): void;
111
+ cancel_all(): void;
83
112
  exit(args: IOrderArgs): void;
84
113
  private _pendingOrderHandle;
85
- private _longOrderHandle;
86
- private _shortOrderHandle;
114
+ private _entryOrderHandle;
115
+ private _orderOrderHandle;
87
116
  private _closeOrderHandle;
88
117
  private _exitOrderHandle;
89
118
  private _exit;
@@ -65016,7 +65016,7 @@ function Jr(s, i, a) {
65016
65016
  function Tb() {
65017
65017
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
65018
65018
  }
65019
- const pu = new Worker(new URL("" + new URL("assets/scriptsRunWorker-B-xbxuir.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
65019
+ const pu = new Worker(new URL("" + new URL("assets/scriptsRunWorker-DYIZeQ6u.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
65020
65020
  pu.onerror = (s) => {
65021
65021
  console.error(s);
65022
65022
  };
@@ -135,7 +135,7 @@ function print() { __p += __j.call(arguments, '') }
135
135
  * @license
136
136
  * Copyright 2019 Google LLC
137
137
  * SPDX-License-Identifier: Apache-2.0
138
- */const eo=Symbol("Comlink.proxy"),ep=Symbol("Comlink.endpoint"),tp=Symbol("Comlink.releaseProxy"),si=Symbol("Comlink.finalizer"),Ga=Symbol("Comlink.thrown"),to=s=>typeof s=="object"&&s!==null||typeof s=="function",rp={canHandle:s=>to(s)&&s[eo],serialize(s){const{port1:i,port2:a}=new MessageChannel;return ao(s,i),[a,[a]]},deserialize(s){return s.start(),ii(s)}},ap={canHandle:s=>to(s)&&Ga in s,serialize({value:s}){let i;return s instanceof Error?i={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:i={isError:!1,value:s},[i,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},ro=new Map([["proxy",rp],["throw",ap]]);function sp(s,i){for(const a of s)if(i===a||a==="*"||a instanceof RegExp&&a.test(i))return!0;return!1}function ao(s,i=globalThis,a=["*"]){i.addEventListener("message",function l(u){if(!u||!u.data)return;if(!sp(a,u.origin)){console.warn(`Invalid origin '${u.origin}' for comlink proxy`);return}const{id:p,type:m,path:b}=Object.assign({path:[]},u.data),g=(u.data.argumentList||[]).map(_r);let v;try{const w=b.slice(0,-1).reduce((O,P)=>O[P],s),D=b.reduce((O,P)=>O[P],s);switch(m){case"GET":v=D;break;case"SET":w[b.slice(-1)[0]]=_r(u.data.value),v=!0;break;case"APPLY":v=D.apply(w,g);break;case"CONSTRUCT":{const O=new D(...g);v=up(O)}break;case"ENDPOINT":{const{port1:O,port2:P}=new MessageChannel;ao(s,P),v=cp(O,[O])}break;case"RELEASE":v=void 0;break;default:return}}catch(w){v={value:w,[Ga]:0}}Promise.resolve(v).catch(w=>({value:w,[Ga]:0})).then(w=>{const[D,O]=Qa(w);i.postMessage(Object.assign(Object.assign({},D),{id:p}),O),m==="RELEASE"&&(i.removeEventListener("message",l),so(i),si in s&&typeof s[si]=="function"&&s[si]())}).catch(w=>{const[D,O]=Qa({value:new TypeError("Unserializable return value"),[Ga]:0});i.postMessage(Object.assign(Object.assign({},D),{id:p}),O)})}),i.start&&i.start()}function ip(s){return s.constructor.name==="MessagePort"}function so(s){ip(s)&&s.close()}function ii(s,i){return ni(s,[],i)}function Ya(s){if(s)throw new Error("Proxy has been released and is not useable")}function io(s){return Nr(s,{type:"RELEASE"}).then(()=>{so(s)})}const Va=new WeakMap,Ka="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const i=(Va.get(s)||0)-1;Va.set(s,i),i===0&&io(s)});function np(s,i){const a=(Va.get(i)||0)+1;Va.set(i,a),Ka&&Ka.register(s,i,s)}function op(s){Ka&&Ka.unregister(s)}function ni(s,i=[],a=function(){}){let l=!1;const u=new Proxy(a,{get(p,m){if(Ya(l),m===tp)return()=>{op(u),io(s),l=!0};if(m==="then"){if(i.length===0)return{then:()=>u};const b=Nr(s,{type:"GET",path:i.map(g=>g.toString())}).then(_r);return b.then.bind(b)}return ni(s,[...i,m])},set(p,m,b){Ya(l);const[g,v]=Qa(b);return Nr(s,{type:"SET",path:[...i,m].map(w=>w.toString()),value:g},v).then(_r)},apply(p,m,b){Ya(l);const g=i[i.length-1];if(g===ep)return Nr(s,{type:"ENDPOINT"}).then(_r);if(g==="bind")return ni(s,i.slice(0,-1));const[v,w]=no(b);return Nr(s,{type:"APPLY",path:i.map(D=>D.toString()),argumentList:v},w).then(_r)},construct(p,m){Ya(l);const[b,g]=no(m);return Nr(s,{type:"CONSTRUCT",path:i.map(v=>v.toString()),argumentList:b},g).then(_r)}});return np(u,s),u}function lp(s){return Array.prototype.concat.apply([],s)}function no(s){const i=s.map(Qa);return[i.map(a=>a[0]),lp(i.map(a=>a[1]))]}const oo=new WeakMap;function cp(s,i){return oo.set(s,i),s}function up(s){return Object.assign(s,{[eo]:!0})}function Qa(s){for(const[i,a]of ro)if(a.canHandle(s)){const[l,u]=a.serialize(s);return[{type:"HANDLER",name:i,value:l},u]}return[{type:"RAW",value:s},oo.get(s)||[]]}function _r(s){switch(s.type){case"HANDLER":return ro.get(s.name).deserialize(s.value);case"RAW":return s.value}}function Nr(s,i,a){return new Promise(l=>{const u=dp();s.addEventListener("message",function p(m){!m.data||!m.data.id||m.data.id!==u||(s.removeEventListener("message",p),l(m.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:u},i),a)})}function dp(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const lo=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-B-xbxuir.js").href:new URL("assets/scriptsRunWorker-B-xbxuir.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Fa&&Fa.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});lo.onerror=s=>{console.error(s)};const pp=ii(lo),mp=ii(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-BOXqLi6O.js").href:new URL("assets/parserTccWorker-BOXqLi6O.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Fa&&Fa.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function co(s,i=!1){const{functions:a,types:l,constants:u,variables:p,methods:m}=At;return await mp(s,i,{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(l),constants:Object.fromEntries(u),variables:Object.fromEntries(p)})}async function uo(s,i,a=!0){return await pp(s,i,a)}function fp(s){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-CT5Cb1wO.js").href:new URL("assets/editor.worker-CT5Cb1wO.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{name:s==null?void 0:s.name})}var Ct;(function(s){s.BOOL="bool",s.INT="int",s.FLOAT="float",s.ARRAY="array",s.BOX="box",s.CHART_POINT="chart.point",s.COLOR="color",s.CONST="const",s.LABEL="label",s.LINE="line",s.LINEFILL="linefill",s.MAP="map",s.MATRIX="matrix",s.POLYLINE="polyline",s.SERIES="series",s.SIMPLE="simple",s.STRING="string",s.TABLE="table",s.UNDETERMINED="undetermined type",s.INPUT="input",s.NA="na",s.VOID="void"})(Ct||(Ct={}));var po;(function(s){s.FlowStmt="FlowStmt",s.DeclareAssign="DeclareAssign",s.VarBlockStmt="VarBlockStmt",s.VarSingle="VarSingle",s.VarMultiple="VarMultiple",s.ParenthesizedExpression="ParenthesizedExpression",s.AdditiveExpression="AdditiveExpression",s.RelationalExpression="RelationalExpression",s.EqualityExpression="EqualityExpression",s.TernaryExpression="TernaryExpression",s.UnaryExpression="UnaryExpression",s.NotExpression="NotExpression",s.MemberIndexExpression="MemberIndexExpression",s.MethodExpression="MethodExpression",s.LogicalAndExpression="LogicalAndExpression",s.LogicalOrExpression="LogicalOrExpression",s.MultiplicativeExpression="MultiplicativeExpression",s.Brackethesized="Brackethesized",s.IfStatement="IfStatement",s.ForToStatement="ForToStatement",s.ForInStatement="ForInStatement",s.SwitchStatement="SwitchStatement",s.CaseClause="CaseClause",s.DefaultCaluse="DefaultCaluse",s.WhileStatement="WhileStatement",s.ImportElement="ImportElement",s.Literal="Literal",s.ArrowFunction="ArrowFunction",s.ArrowMethod="ArrowMethod",s.TypeStatement="TypeStatement",s.Name="Name",s.AgainAssign="AgainAssign"})(po||(po={}));var mo;(function(s){s.dividends="dividends",s.none="none",s.splits="splits"})(mo||(mo={}));var fo;(function(s){s.freqAll="freq_all",s.freqOncePerBar="freq_once_per_bar",s.freqOncePerBarClose="freq_once_per_bar_close"})(fo||(fo={}));var yo;(function(s){s.gapsOff="gaps_off",s.gapsOn="gaps_on",s.lookaheadOff="lookahead_off",s.lookaheadOn="lookahead_on"})(yo||(yo={}));var ho;(function(s){s.all="all",s.dataWindow="data_window",s.none="none",s.pane="pane",s.priceScale="price_scale",s.statusLine="status_line"})(ho||(ho={}));var _o;(function(s){s.both="both",s.left="left",s.none="none",s.right="right"})(_o||(_o={}));var go;(function(s){s.inherit="inherit",s.mintick="mintick",s.percent="percent",s.price="price",s.volume="volume"})(go||(go={}));var bo;(function(s){s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid"})(bo||(bo={}));var xo;(function(s){s.styleArrowdown="style_arrowdown",s.styleArrowup="style_arrowup",s.styleCircle="style_circle",s.styleCross="style_cross",s.styleDiamond="style_diamond",s.styleFlag="style_flag",s.styleLabelCenter="style_label_center",s.styleLabelDown="style_label_down",s.styleLabelLeft="style_label_left",s.styleLabelLowerLeft="style_label_lower_left",s.styleLabelLowerRight="style_label_lower_right",s.styleLabelRight="style_label_right",s.styleLabelUp="style_label_up",s.styleLabelUpperLeft="style_label_upper_left",s.styleLabelUpperRight="style_label_upper_right",s.styleNone="style_none",s.styleSquare="style_square",s.styleTextOutline="style_text_outline",s.styleTriangledown="style_triangledown",s.styleTriangleup="style_triangleup",s.styleXcross="style_xcross"})(xo||(xo={}));var vo;(function(s){s.styleArrowBoth="style_arrow_both",s.styleArrowLeft="style_arrow_left",s.styleArrowRight="style_arrow_right",s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid"})(vo||(vo={}));var wo;(function(s){s.abovebar="abovebar",s.absolute="absolute",s.belowbar="belowbar",s.bottom="bottom",s.top="top"})(wo||(wo={}));var To;(function(s){s.ascending="ascending",s.descending="descending"})(To||(To={}));var Io;(function(s){s.styleArea="Area",s.styleAreabr="Area With Breaks",s.styleCircles="Circles",s.styleColumns="Columns",s.styleCross="Cross",s.styleHistogram="Histogram",s.styleLine="Line",s.styleLinebr="Line With Breaks",s.styleStepline="Step Line",s.styleSteplineDiamond="Step Line With Diamonds",s.styleSteplinebr="Step line with Breaks"})(Io||(Io={}));var Do;(function(s){s.bottomCenter="bottom_center",s.bottomLeft="bottom_left",s.bottomRight="bottom_right",s.middleCenter="middle_center",s.middleLeft="middle_left",s.middleRight="middle_right",s.topCenter="top_center",s.topLeft="top_left",s.topRight="top_right"})(Do||(Do={}));var ko;(function(s){s.left="left",s.none="none",s.right="right"})(ko||(ko={}));var Ao;(function(s){s.extended="extended",s.regular="regular"})(Ao||(Ao={}));var qo;(function(s){s.arrowdown="arrowdown",s.arrowup="arrowup",s.circle="circle",s.cross="cross",s.diamond="diamond",s.flag="flag",s.labeldown="labeldown",s.labelup="labelup",s.square="square",s.triangledown="triangledown",s.triangleup="triangleup",s.xcross="xcross"})(qo||(qo={}));var Co;(function(s){s.auto="auto",s.huge="huge",s.large="large",s.normal="normal",s.small="small",s.tiny="tiny"})(Co||(Co={}));var So;(function(s){s.cash="cash",s.fixed="fixed",s.percentOfEquity="percent_of_equity"})(So||(So={}));var zo;(function(s){s.cashPerContract="cash_per_contract",s.cashPerOrder="cash_per_order",s.percent="percent"})(zo||(zo={}));var No;(function(s){s.all="all",s.long="long",s.short="short"})(No||(No={}));var Oo;(function(s){s.cancel="cancel",s.none="none",s.reduce="reduce"})(Oo||(Oo={}));var Po;(function(s){s.alignBottom="align_bottom",s.alignCenter="align_center",s.alignLeft="align_left",s.alignRight="align_right",s.alignTop="align_top",s.wrapAuto="wrap_auto",s.wrapNone="wrap_none"})(Po||(Po={}));var Ro;(function(s){s.bar_index="bar_index",s.bar_time="bar_time"})(Ro||(Ro={}));var Eo;(function(s){s.abovebar="abovebar",s.belowbar="belowbar",s.price="price"})(Eo||(Eo={}));var Lo;(function(s){s.actual="actual",s.estimate="estimate",s.standardized="standardized"})(Lo||(Lo={}));var Mo;(function(s){s.traditional="Traditional",s.fibonacci="Fibonacci",s.woodie="Woodie",s.classic="Classic",s.dm="DM",s.camarilla="Camarilla"})(Mo||(Mo={})),Ct.SERIES,Ct.SIMPLE,Ct.INPUT,Ct.CONST,Ct.INT,Ct.FLOAT,Ct.BOOL,Ct.COLOR,Ct.STRING;const yp={domReadOnly:!0,scrollBeyondLastLine:!1,readOnly:!0,minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1},contextmenu:!1};self.MonacoEnvironment={getWorker(){return new fp({name:"Editor Worker"})}},Qs.config({monaco:pu});const hp=(s,i)=>{const{height:a,width:l,theme:u,options:p,hasDiff:m,readOnly:b,onChange:g,onDeclareConfigChange:v,onCursorPositionChange:w}=s,D=M.useRef(null);M.useImperativeHandle(i,()=>({saveScript(){var E;(E=D.current)==null||E.saveScripts()},setScript(E){var K;(K=D.current)==null||K.setValue(E)},gotoLine(){var E;(E=D.current)==null||E.gotoLine()},getEditorLayout(){var E;return(E=D.current)==null?void 0:E.getEditorLayout()}})),M.useEffect(()=>{var E,K;m?(K=D.current)==null||K.addDiffDecorations():(E=D.current)==null||E.removeDiffDecorations()},[m]);function O(E,K){var he;zr.initBuiltinsTrees(),D.current=new Jd(E,K),m&&((he=D.current)==null||he.addDiffDecorations());const $=E.getValue()+`
138
+ */const eo=Symbol("Comlink.proxy"),ep=Symbol("Comlink.endpoint"),tp=Symbol("Comlink.releaseProxy"),si=Symbol("Comlink.finalizer"),Ga=Symbol("Comlink.thrown"),to=s=>typeof s=="object"&&s!==null||typeof s=="function",rp={canHandle:s=>to(s)&&s[eo],serialize(s){const{port1:i,port2:a}=new MessageChannel;return ao(s,i),[a,[a]]},deserialize(s){return s.start(),ii(s)}},ap={canHandle:s=>to(s)&&Ga in s,serialize({value:s}){let i;return s instanceof Error?i={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:i={isError:!1,value:s},[i,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},ro=new Map([["proxy",rp],["throw",ap]]);function sp(s,i){for(const a of s)if(i===a||a==="*"||a instanceof RegExp&&a.test(i))return!0;return!1}function ao(s,i=globalThis,a=["*"]){i.addEventListener("message",function l(u){if(!u||!u.data)return;if(!sp(a,u.origin)){console.warn(`Invalid origin '${u.origin}' for comlink proxy`);return}const{id:p,type:m,path:b}=Object.assign({path:[]},u.data),g=(u.data.argumentList||[]).map(_r);let v;try{const w=b.slice(0,-1).reduce((O,P)=>O[P],s),D=b.reduce((O,P)=>O[P],s);switch(m){case"GET":v=D;break;case"SET":w[b.slice(-1)[0]]=_r(u.data.value),v=!0;break;case"APPLY":v=D.apply(w,g);break;case"CONSTRUCT":{const O=new D(...g);v=up(O)}break;case"ENDPOINT":{const{port1:O,port2:P}=new MessageChannel;ao(s,P),v=cp(O,[O])}break;case"RELEASE":v=void 0;break;default:return}}catch(w){v={value:w,[Ga]:0}}Promise.resolve(v).catch(w=>({value:w,[Ga]:0})).then(w=>{const[D,O]=Qa(w);i.postMessage(Object.assign(Object.assign({},D),{id:p}),O),m==="RELEASE"&&(i.removeEventListener("message",l),so(i),si in s&&typeof s[si]=="function"&&s[si]())}).catch(w=>{const[D,O]=Qa({value:new TypeError("Unserializable return value"),[Ga]:0});i.postMessage(Object.assign(Object.assign({},D),{id:p}),O)})}),i.start&&i.start()}function ip(s){return s.constructor.name==="MessagePort"}function so(s){ip(s)&&s.close()}function ii(s,i){return ni(s,[],i)}function Ya(s){if(s)throw new Error("Proxy has been released and is not useable")}function io(s){return Nr(s,{type:"RELEASE"}).then(()=>{so(s)})}const Va=new WeakMap,Ka="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const i=(Va.get(s)||0)-1;Va.set(s,i),i===0&&io(s)});function np(s,i){const a=(Va.get(i)||0)+1;Va.set(i,a),Ka&&Ka.register(s,i,s)}function op(s){Ka&&Ka.unregister(s)}function ni(s,i=[],a=function(){}){let l=!1;const u=new Proxy(a,{get(p,m){if(Ya(l),m===tp)return()=>{op(u),io(s),l=!0};if(m==="then"){if(i.length===0)return{then:()=>u};const b=Nr(s,{type:"GET",path:i.map(g=>g.toString())}).then(_r);return b.then.bind(b)}return ni(s,[...i,m])},set(p,m,b){Ya(l);const[g,v]=Qa(b);return Nr(s,{type:"SET",path:[...i,m].map(w=>w.toString()),value:g},v).then(_r)},apply(p,m,b){Ya(l);const g=i[i.length-1];if(g===ep)return Nr(s,{type:"ENDPOINT"}).then(_r);if(g==="bind")return ni(s,i.slice(0,-1));const[v,w]=no(b);return Nr(s,{type:"APPLY",path:i.map(D=>D.toString()),argumentList:v},w).then(_r)},construct(p,m){Ya(l);const[b,g]=no(m);return Nr(s,{type:"CONSTRUCT",path:i.map(v=>v.toString()),argumentList:b},g).then(_r)}});return np(u,s),u}function lp(s){return Array.prototype.concat.apply([],s)}function no(s){const i=s.map(Qa);return[i.map(a=>a[0]),lp(i.map(a=>a[1]))]}const oo=new WeakMap;function cp(s,i){return oo.set(s,i),s}function up(s){return Object.assign(s,{[eo]:!0})}function Qa(s){for(const[i,a]of ro)if(a.canHandle(s)){const[l,u]=a.serialize(s);return[{type:"HANDLER",name:i,value:l},u]}return[{type:"RAW",value:s},oo.get(s)||[]]}function _r(s){switch(s.type){case"HANDLER":return ro.get(s.name).deserialize(s.value);case"RAW":return s.value}}function Nr(s,i,a){return new Promise(l=>{const u=dp();s.addEventListener("message",function p(m){!m.data||!m.data.id||m.data.id!==u||(s.removeEventListener("message",p),l(m.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:u},i),a)})}function dp(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const lo=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-DYIZeQ6u.js").href:new URL("assets/scriptsRunWorker-DYIZeQ6u.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Fa&&Fa.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});lo.onerror=s=>{console.error(s)};const pp=ii(lo),mp=ii(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-BOXqLi6O.js").href:new URL("assets/parserTccWorker-BOXqLi6O.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Fa&&Fa.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function co(s,i=!1){const{functions:a,types:l,constants:u,variables:p,methods:m}=At;return await mp(s,i,{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(l),constants:Object.fromEntries(u),variables:Object.fromEntries(p)})}async function uo(s,i,a=!0){return await pp(s,i,a)}function fp(s){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-CT5Cb1wO.js").href:new URL("assets/editor.worker-CT5Cb1wO.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{name:s==null?void 0:s.name})}var Ct;(function(s){s.BOOL="bool",s.INT="int",s.FLOAT="float",s.ARRAY="array",s.BOX="box",s.CHART_POINT="chart.point",s.COLOR="color",s.CONST="const",s.LABEL="label",s.LINE="line",s.LINEFILL="linefill",s.MAP="map",s.MATRIX="matrix",s.POLYLINE="polyline",s.SERIES="series",s.SIMPLE="simple",s.STRING="string",s.TABLE="table",s.UNDETERMINED="undetermined type",s.INPUT="input",s.NA="na",s.VOID="void"})(Ct||(Ct={}));var po;(function(s){s.FlowStmt="FlowStmt",s.DeclareAssign="DeclareAssign",s.VarBlockStmt="VarBlockStmt",s.VarSingle="VarSingle",s.VarMultiple="VarMultiple",s.ParenthesizedExpression="ParenthesizedExpression",s.AdditiveExpression="AdditiveExpression",s.RelationalExpression="RelationalExpression",s.EqualityExpression="EqualityExpression",s.TernaryExpression="TernaryExpression",s.UnaryExpression="UnaryExpression",s.NotExpression="NotExpression",s.MemberIndexExpression="MemberIndexExpression",s.MethodExpression="MethodExpression",s.LogicalAndExpression="LogicalAndExpression",s.LogicalOrExpression="LogicalOrExpression",s.MultiplicativeExpression="MultiplicativeExpression",s.Brackethesized="Brackethesized",s.IfStatement="IfStatement",s.ForToStatement="ForToStatement",s.ForInStatement="ForInStatement",s.SwitchStatement="SwitchStatement",s.CaseClause="CaseClause",s.DefaultCaluse="DefaultCaluse",s.WhileStatement="WhileStatement",s.ImportElement="ImportElement",s.Literal="Literal",s.ArrowFunction="ArrowFunction",s.ArrowMethod="ArrowMethod",s.TypeStatement="TypeStatement",s.Name="Name",s.AgainAssign="AgainAssign"})(po||(po={}));var mo;(function(s){s.dividends="dividends",s.none="none",s.splits="splits"})(mo||(mo={}));var fo;(function(s){s.freqAll="freq_all",s.freqOncePerBar="freq_once_per_bar",s.freqOncePerBarClose="freq_once_per_bar_close"})(fo||(fo={}));var yo;(function(s){s.gapsOff="gaps_off",s.gapsOn="gaps_on",s.lookaheadOff="lookahead_off",s.lookaheadOn="lookahead_on"})(yo||(yo={}));var ho;(function(s){s.all="all",s.dataWindow="data_window",s.none="none",s.pane="pane",s.priceScale="price_scale",s.statusLine="status_line"})(ho||(ho={}));var _o;(function(s){s.both="both",s.left="left",s.none="none",s.right="right"})(_o||(_o={}));var go;(function(s){s.inherit="inherit",s.mintick="mintick",s.percent="percent",s.price="price",s.volume="volume"})(go||(go={}));var bo;(function(s){s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid"})(bo||(bo={}));var xo;(function(s){s.styleArrowdown="style_arrowdown",s.styleArrowup="style_arrowup",s.styleCircle="style_circle",s.styleCross="style_cross",s.styleDiamond="style_diamond",s.styleFlag="style_flag",s.styleLabelCenter="style_label_center",s.styleLabelDown="style_label_down",s.styleLabelLeft="style_label_left",s.styleLabelLowerLeft="style_label_lower_left",s.styleLabelLowerRight="style_label_lower_right",s.styleLabelRight="style_label_right",s.styleLabelUp="style_label_up",s.styleLabelUpperLeft="style_label_upper_left",s.styleLabelUpperRight="style_label_upper_right",s.styleNone="style_none",s.styleSquare="style_square",s.styleTextOutline="style_text_outline",s.styleTriangledown="style_triangledown",s.styleTriangleup="style_triangleup",s.styleXcross="style_xcross"})(xo||(xo={}));var vo;(function(s){s.styleArrowBoth="style_arrow_both",s.styleArrowLeft="style_arrow_left",s.styleArrowRight="style_arrow_right",s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid"})(vo||(vo={}));var wo;(function(s){s.abovebar="abovebar",s.absolute="absolute",s.belowbar="belowbar",s.bottom="bottom",s.top="top"})(wo||(wo={}));var To;(function(s){s.ascending="ascending",s.descending="descending"})(To||(To={}));var Io;(function(s){s.styleArea="Area",s.styleAreabr="Area With Breaks",s.styleCircles="Circles",s.styleColumns="Columns",s.styleCross="Cross",s.styleHistogram="Histogram",s.styleLine="Line",s.styleLinebr="Line With Breaks",s.styleStepline="Step Line",s.styleSteplineDiamond="Step Line With Diamonds",s.styleSteplinebr="Step line with Breaks"})(Io||(Io={}));var Do;(function(s){s.bottomCenter="bottom_center",s.bottomLeft="bottom_left",s.bottomRight="bottom_right",s.middleCenter="middle_center",s.middleLeft="middle_left",s.middleRight="middle_right",s.topCenter="top_center",s.topLeft="top_left",s.topRight="top_right"})(Do||(Do={}));var ko;(function(s){s.left="left",s.none="none",s.right="right"})(ko||(ko={}));var Ao;(function(s){s.extended="extended",s.regular="regular"})(Ao||(Ao={}));var qo;(function(s){s.arrowdown="arrowdown",s.arrowup="arrowup",s.circle="circle",s.cross="cross",s.diamond="diamond",s.flag="flag",s.labeldown="labeldown",s.labelup="labelup",s.square="square",s.triangledown="triangledown",s.triangleup="triangleup",s.xcross="xcross"})(qo||(qo={}));var Co;(function(s){s.auto="auto",s.huge="huge",s.large="large",s.normal="normal",s.small="small",s.tiny="tiny"})(Co||(Co={}));var So;(function(s){s.cash="cash",s.fixed="fixed",s.percentOfEquity="percent_of_equity"})(So||(So={}));var zo;(function(s){s.cashPerContract="cash_per_contract",s.cashPerOrder="cash_per_order",s.percent="percent"})(zo||(zo={}));var No;(function(s){s.all="all",s.long="long",s.short="short"})(No||(No={}));var Oo;(function(s){s.cancel="cancel",s.none="none",s.reduce="reduce"})(Oo||(Oo={}));var Po;(function(s){s.alignBottom="align_bottom",s.alignCenter="align_center",s.alignLeft="align_left",s.alignRight="align_right",s.alignTop="align_top",s.wrapAuto="wrap_auto",s.wrapNone="wrap_none"})(Po||(Po={}));var Ro;(function(s){s.bar_index="bar_index",s.bar_time="bar_time"})(Ro||(Ro={}));var Eo;(function(s){s.abovebar="abovebar",s.belowbar="belowbar",s.price="price"})(Eo||(Eo={}));var Lo;(function(s){s.actual="actual",s.estimate="estimate",s.standardized="standardized"})(Lo||(Lo={}));var Mo;(function(s){s.traditional="Traditional",s.fibonacci="Fibonacci",s.woodie="Woodie",s.classic="Classic",s.dm="DM",s.camarilla="Camarilla"})(Mo||(Mo={})),Ct.SERIES,Ct.SIMPLE,Ct.INPUT,Ct.CONST,Ct.INT,Ct.FLOAT,Ct.BOOL,Ct.COLOR,Ct.STRING;const yp={domReadOnly:!0,scrollBeyondLastLine:!1,readOnly:!0,minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1},contextmenu:!1};self.MonacoEnvironment={getWorker(){return new fp({name:"Editor Worker"})}},Qs.config({monaco:pu});const hp=(s,i)=>{const{height:a,width:l,theme:u,options:p,hasDiff:m,readOnly:b,onChange:g,onDeclareConfigChange:v,onCursorPositionChange:w}=s,D=M.useRef(null);M.useImperativeHandle(i,()=>({saveScript(){var E;(E=D.current)==null||E.saveScripts()},setScript(E){var K;(K=D.current)==null||K.setValue(E)},gotoLine(){var E;(E=D.current)==null||E.gotoLine()},getEditorLayout(){var E;return(E=D.current)==null?void 0:E.getEditorLayout()}})),M.useEffect(()=>{var E,K;m?(K=D.current)==null||K.addDiffDecorations():(E=D.current)==null||E.removeDiffDecorations()},[m]);function O(E,K){var he;zr.initBuiltinsTrees(),D.current=new Jd(E,K),m&&((he=D.current)==null||he.addDiffDecorations());const $=E.getValue()+`
139
139
 
140
140
  `;D.current.onChangeCursorPosition(w),g&&g($),!b&&P($)}const P=M.useCallback(async E=>{var j;const K=Date.now(),{errors:$,functions:he,methods:le,types:Z,variables:ue,overloadsFuncs:ee,preParserCode:ze}=await co(E),ge=new Map(Object.entries(he)),se=new Map(Object.entries(le)),ot=new Map(Object.entries(Z)),_t=new Map(Object.entries(ue));la.setUserDefined({functions:ge,methods:se,types:ot,variables:_t},ee),zr.setUserDefind(ge,ot,_t,se);const Re=$.map(re=>({...re,severity:re.type||st.MarkerSeverity.Error}));if(b)return;try{console.log(ze);const re=await uo(ze,{isPreParser:!0});console.log(re),v&&v(re)}catch(re){console.log(re,"==================error- Run TccScript Server"),$.push({message:`Runtime Error: ${re.message}`,startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0})}(j=D.current)==null||j.setModelMarkers(Re);const Ee=Date.now();console.log((Ee-K)/1e3)},[v,b]),F=M.useMemo(()=>zd.debounce(P,1e3),[P]);function B(E){var K;if(b){P(E||"");return}(K=D.current)==null||K.setModelMarkers([]),localStorage.setItem(Vn,E||""),E!==void 0&&(E=E+`
141
141
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guihz/trading-vue-editor-tes",
3
- "version": "0.0.012",
3
+ "version": "0.0.013",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "lib"