@guihz/trading-vue-editor-tes 0.0.58 → 0.0.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,4 +63,4 @@ ${$f}`)}function D1(i,t,e){return(i>=0&&e?` ${Rf(i,t-1)}`:Rf(i,t)).padEnd(t)}fun
63
63
  * @license
64
64
  * Copyright 2019 Google LLC
65
65
  * SPDX-License-Identifier: Apache-2.0
66
- */const Vf=Symbol("Comlink.proxy"),uy=Symbol("Comlink.endpoint"),ly=Symbol("Comlink.releaseProxy"),za=Symbol("Comlink.finalizer"),oo=Symbol("Comlink.thrown"),th=i=>typeof i=="object"&&i!==null||typeof i=="function",cy={canHandle:i=>th(i)&&i[Vf],serialize(i){const{port1:t,port2:e}=new MessageChannel;return qa(i,t),[e,[e]]},deserialize(i){return i.start(),dy(i)}},fy={canHandle:i=>th(i)&&oo in i,serialize({value:i}){let t;return i instanceof Error?t={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:t={isError:!1,value:i},[t,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},eh=new Map([["proxy",cy],["throw",fy]]);function hy(i,t){for(const e of i)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function qa(i,t=globalThis,e=["*"]){t.addEventListener("message",function r(n){if(!n||!n.data)return;if(!hy(e,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:s,type:a,path:l}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(Kn);let h;try{const p=l.slice(0,-1).reduce((d,g)=>d[g],i),f=l.reduce((d,g)=>d[g],i);switch(a){case"GET":h=f;break;case"SET":p[l.slice(-1)[0]]=Kn(n.data.value),h=!0;break;case"APPLY":h=f.apply(p,c);break;case"CONSTRUCT":{const d=new f(...c);h=wy(d)}break;case"ENDPOINT":{const{port1:d,port2:g}=new MessageChannel;qa(i,g),h=vy(d,[d])}break;case"RELEASE":h=void 0;break;default:return}}catch(p){h={value:p,[oo]:0}}Promise.resolve(h).catch(p=>({value:p,[oo]:0})).then(p=>{const[f,d]=co(p);t.postMessage(Object.assign(Object.assign({},f),{id:s}),d),a==="RELEASE"&&(t.removeEventListener("message",r),rh(t),za in i&&typeof i[za]=="function"&&i[za]())}).catch(p=>{const[f,d]=co({value:new TypeError("Unserializable return value"),[oo]:0});t.postMessage(Object.assign(Object.assign({},f),{id:s}),d)})}),t.start&&t.start()}function py(i){return i.constructor.name==="MessagePort"}function rh(i){py(i)&&i.close()}function dy(i,t){return ka(i,[],t)}function ao(i){if(i)throw new Error("Proxy has been released and is not useable")}function nh(i){return bi(i,{type:"RELEASE"}).then(()=>{rh(i)})}const uo=new WeakMap,lo="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{const t=(uo.get(i)||0)-1;uo.set(i,t),t===0&&nh(i)});function _y(i,t){const e=(uo.get(t)||0)+1;uo.set(t,e),lo&&lo.register(i,t,i)}function my(i){lo&&lo.unregister(i)}function ka(i,t=[],e=function(){}){let r=!1;const n=new Proxy(e,{get(s,a){if(ao(r),a===ly)return()=>{my(n),nh(i),r=!0};if(a==="then"){if(t.length===0)return{then:()=>n};const l=bi(i,{type:"GET",path:t.map(c=>c.toString())}).then(Kn);return l.then.bind(l)}return ka(i,[...t,a])},set(s,a,l){ao(r);const[c,h]=co(l);return bi(i,{type:"SET",path:[...t,a].map(p=>p.toString()),value:c},h).then(Kn)},apply(s,a,l){ao(r);const c=t[t.length-1];if(c===uy)return bi(i,{type:"ENDPOINT"}).then(Kn);if(c==="bind")return ka(i,t.slice(0,-1));const[h,p]=ih(l);return bi(i,{type:"APPLY",path:t.map(f=>f.toString()),argumentList:h},p).then(Kn)},construct(s,a){ao(r);const[l,c]=ih(a);return bi(i,{type:"CONSTRUCT",path:t.map(h=>h.toString()),argumentList:l},c).then(Kn)}});return _y(n,i),n}function gy(i){return Array.prototype.concat.apply([],i)}function ih(i){const t=i.map(co);return[t.map(e=>e[0]),gy(t.map(e=>e[1]))]}const sh=new WeakMap;function vy(i,t){return sh.set(i,t),i}function wy(i){return Object.assign(i,{[Vf]:!0})}function co(i){for(const[t,e]of eh)if(e.canHandle(i)){const[r,n]=e.serialize(i);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:i},sh.get(i)||[]]}function Kn(i){switch(i.type){case"HANDLER":return eh.get(i.name).deserialize(i.value);case"RAW":return i.value}}function bi(i,t,e){return new Promise(r=>{const n=yy();i.addEventListener("message",function s(a){!a.data||!a.data.id||a.data.id!==n||(i.removeEventListener("message",s),r(a.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:n},t),e)})}function yy(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class Dy{constructor(){z(this,"_cache");this._cache=new Map}set(t,e){this._cache.set(t,e)}setValue(t,e,r){const n=this._cache.get(t)||{};n[e]=r,this._cache.set(t,n)}updateValue(t,e,r){const n=this._cache.get(t)||{};this._cache.set(t,Object.assign(n[e]||{},r))}get(t){return this._cache.get(t)}has(t){return this._cache.has(t)}delete(t){this._cache.delete(t)}clear(){this._cache.clear()}}function by(i,t,e){const{data:r,isPreParser:n,id:s="default",syminfo:a,interval:l,inputs:c}=t;self.workerStorage||(self.workerStorage=new Dy);let{builtInGather:h,buildinConstants:p,buildInFunctions:f,tradingvueFunc:d}=self.workerStorage.get(s)||{};if(e&&(h=new ty,p=new Lw,f=new ay(a.mintick||1e-4,h,s),d=new Function("$_var","$_const","$_func",i),self.workerStorage.set(s,{builtInGather:h,buildinConstants:p,buildInFunctions:f,tradingvueFunc:d})),n)d(h,p,f);else if(r&&r.length){const w=r.length-1;h.updataOptions({interval:l}),f.updataOptions({inputs:c});for(const[m,D]of r.entries()){const{barindex:v}=D;h.updateData(Object.assign(D,{barIndex:v||m,lastBarIndex:r[w].bar_index||w,lastBarTime:r[w].time})),f.update({barIndex:v||m}),d(h,p,f),f.endExecution();const E=f.errors;if(E.length&&E.some(b=>b.type===Ee.Error))return{status:1,errors:E}}}const g=f.errors;return g.length&&g.some(w=>w.type===Ee.Error)?{status:1,errors:g}:{status:0,options:{...self.buildInFunctions.options,id:s}}}function Ey(i){self==null||self.workerStorage.delete(i),self==null||self.workerStorage.delete(`inputs_${i}`)}qa({runScript:by,removeScript:Ey})})();
66
+ */const Vf=Symbol("Comlink.proxy"),uy=Symbol("Comlink.endpoint"),ly=Symbol("Comlink.releaseProxy"),za=Symbol("Comlink.finalizer"),oo=Symbol("Comlink.thrown"),th=i=>typeof i=="object"&&i!==null||typeof i=="function",cy={canHandle:i=>th(i)&&i[Vf],serialize(i){const{port1:t,port2:e}=new MessageChannel;return qa(i,t),[e,[e]]},deserialize(i){return i.start(),dy(i)}},fy={canHandle:i=>th(i)&&oo in i,serialize({value:i}){let t;return i instanceof Error?t={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:t={isError:!1,value:i},[t,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},eh=new Map([["proxy",cy],["throw",fy]]);function hy(i,t){for(const e of i)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function qa(i,t=globalThis,e=["*"]){t.addEventListener("message",function r(n){if(!n||!n.data)return;if(!hy(e,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:s,type:a,path:l}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(Kn);let h;try{const p=l.slice(0,-1).reduce((d,g)=>d[g],i),f=l.reduce((d,g)=>d[g],i);switch(a){case"GET":h=f;break;case"SET":p[l.slice(-1)[0]]=Kn(n.data.value),h=!0;break;case"APPLY":h=f.apply(p,c);break;case"CONSTRUCT":{const d=new f(...c);h=wy(d)}break;case"ENDPOINT":{const{port1:d,port2:g}=new MessageChannel;qa(i,g),h=vy(d,[d])}break;case"RELEASE":h=void 0;break;default:return}}catch(p){h={value:p,[oo]:0}}Promise.resolve(h).catch(p=>({value:p,[oo]:0})).then(p=>{const[f,d]=co(p);t.postMessage(Object.assign(Object.assign({},f),{id:s}),d),a==="RELEASE"&&(t.removeEventListener("message",r),rh(t),za in i&&typeof i[za]=="function"&&i[za]())}).catch(p=>{const[f,d]=co({value:new TypeError("Unserializable return value"),[oo]:0});t.postMessage(Object.assign(Object.assign({},f),{id:s}),d)})}),t.start&&t.start()}function py(i){return i.constructor.name==="MessagePort"}function rh(i){py(i)&&i.close()}function dy(i,t){return ka(i,[],t)}function ao(i){if(i)throw new Error("Proxy has been released and is not useable")}function nh(i){return bi(i,{type:"RELEASE"}).then(()=>{rh(i)})}const uo=new WeakMap,lo="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{const t=(uo.get(i)||0)-1;uo.set(i,t),t===0&&nh(i)});function _y(i,t){const e=(uo.get(t)||0)+1;uo.set(t,e),lo&&lo.register(i,t,i)}function my(i){lo&&lo.unregister(i)}function ka(i,t=[],e=function(){}){let r=!1;const n=new Proxy(e,{get(s,a){if(ao(r),a===ly)return()=>{my(n),nh(i),r=!0};if(a==="then"){if(t.length===0)return{then:()=>n};const l=bi(i,{type:"GET",path:t.map(c=>c.toString())}).then(Kn);return l.then.bind(l)}return ka(i,[...t,a])},set(s,a,l){ao(r);const[c,h]=co(l);return bi(i,{type:"SET",path:[...t,a].map(p=>p.toString()),value:c},h).then(Kn)},apply(s,a,l){ao(r);const c=t[t.length-1];if(c===uy)return bi(i,{type:"ENDPOINT"}).then(Kn);if(c==="bind")return ka(i,t.slice(0,-1));const[h,p]=ih(l);return bi(i,{type:"APPLY",path:t.map(f=>f.toString()),argumentList:h},p).then(Kn)},construct(s,a){ao(r);const[l,c]=ih(a);return bi(i,{type:"CONSTRUCT",path:t.map(h=>h.toString()),argumentList:l},c).then(Kn)}});return _y(n,i),n}function gy(i){return Array.prototype.concat.apply([],i)}function ih(i){const t=i.map(co);return[t.map(e=>e[0]),gy(t.map(e=>e[1]))]}const sh=new WeakMap;function vy(i,t){return sh.set(i,t),i}function wy(i){return Object.assign(i,{[Vf]:!0})}function co(i){for(const[t,e]of eh)if(e.canHandle(i)){const[r,n]=e.serialize(i);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:i},sh.get(i)||[]]}function Kn(i){switch(i.type){case"HANDLER":return eh.get(i.name).deserialize(i.value);case"RAW":return i.value}}function bi(i,t,e){return new Promise(r=>{const n=yy();i.addEventListener("message",function s(a){!a.data||!a.data.id||a.data.id!==n||(i.removeEventListener("message",s),r(a.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:n},t),e)})}function yy(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class Dy{constructor(){z(this,"_cache");this._cache=new Map}set(t,e){this._cache.set(t,e)}setValue(t,e,r){const n=this._cache.get(t)||{};n[e]=r,this._cache.set(t,n)}updateValue(t,e,r){const n=this._cache.get(t)||{};this._cache.set(t,Object.assign(n[e]||{},r))}get(t){return this._cache.get(t)}has(t){return this._cache.has(t)}delete(t){this._cache.delete(t)}clear(){this._cache.clear()}}function by(i,t,e){const{data:r,isPreParser:n,id:s="default",syminfo:a,interval:l,inputs:c}=t;self.workerStorage||(self.workerStorage=new Dy);let{builtInGather:h,buildinConstants:p,buildInFunctions:f,tradingvueFunc:d}=self.workerStorage.get(s)||{};if(e&&(h=new ty,p=new Lw,f=new ay((a==null?void 0:a.mintick)||1e-4,h,s),d=new Function("$_var","$_const","$_func",i),self.workerStorage.set(s,{builtInGather:h,buildinConstants:p,buildInFunctions:f,tradingvueFunc:d})),n)d(h,p,f);else if(r&&r.length){const w=r.length-1;h.updataOptions({interval:l}),f.updataOptions({inputs:c});for(const[m,D]of r.entries()){const{barindex:v}=D;h.updateData(Object.assign(D,{barIndex:v||m,lastBarIndex:r[w].bar_index||w,lastBarTime:r[w].time})),f.update({barIndex:v||m}),d(h,p,f),f.endExecution();const E=f.errors;if(E.length&&E.some(b=>b.type===Ee.Error))return{status:1,errors:E}}}const g=f.errors;return g.length&&g.some(w=>w.type===Ee.Error)?{status:1,errors:g}:{status:0,options:{...self.buildInFunctions.options,id:s}}}function Ey(i){self==null||self.workerStorage.delete(i),self==null||self.workerStorage.delete(`inputs_${i}`)}qa({runScript:by,removeScript:Ey})})();
@@ -66610,7 +66610,7 @@ function ss(a, n, s) {
66610
66610
  function Zb() {
66611
66611
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
66612
66612
  }
66613
- const Pu = new Worker(new URL("" + new URL("assets/scriptsRunWorker-CTlk4g3L.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
66613
+ const Pu = new Worker(new URL("" + new URL("assets/scriptsRunWorker-B8F9UHxw.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
66614
66614
  Pu.onerror = (a) => {
66615
66615
  console.error(a);
66616
66616
  };
@@ -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 uo=Symbol("Comlink.proxy"),Kd=Symbol("Comlink.endpoint"),Qd=Symbol("Comlink.releaseProxy"),mn=Symbol("Comlink.finalizer"),Va=Symbol("Comlink.thrown"),po=s=>typeof s=="object"&&s!==null||typeof s=="function",Jd={canHandle:s=>po(s)&&s[uo],serialize(s){const{port1:n,port2:a}=new MessageChannel;return fo(s,n),[a,[a]]},deserialize(s){return s.start(),fn(s)}},Zd={canHandle:s=>po(s)&&Va in s,serialize({value:s}){let n;return s instanceof Error?n={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:n={isError:!1,value:s},[n,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},mo=new Map([["proxy",Jd],["throw",Zd]]);function ep(s,n){for(const a of s)if(n===a||a==="*"||a instanceof RegExp&&a.test(n))return!0;return!1}function fo(s,n=globalThis,a=["*"]){n.addEventListener("message",function o(u){if(!u||!u.data)return;if(!ep(a,u.origin)){console.warn(`Invalid origin '${u.origin}' for comlink proxy`);return}const{id:c,type:m,path:h}=Object.assign({path:[]},u.data),b=(u.data.argumentList||[]).map(_r);let g;try{const x=h.slice(0,-1).reduce((R,L)=>R[L],s),T=h.reduce((R,L)=>R[L],s);switch(m){case"GET":g=T;break;case"SET":x[h.slice(-1)[0]]=_r(u.data.value),g=!0;break;case"APPLY":g=T.apply(x,b);break;case"CONSTRUCT":{const R=new T(...b);g=ip(R)}break;case"ENDPOINT":{const{port1:R,port2:L}=new MessageChannel;fo(s,L),g=np(R,[R])}break;case"RELEASE":g=void 0;break;default:return}}catch(x){g={value:x,[Va]:0}}Promise.resolve(g).catch(x=>({value:x,[Va]:0})).then(x=>{const[T,R]=Ja(x);n.postMessage(Object.assign(Object.assign({},T),{id:c}),R),m==="RELEASE"&&(n.removeEventListener("message",o),yo(n),mn in s&&typeof s[mn]=="function"&&s[mn]())}).catch(x=>{const[T,R]=Ja({value:new TypeError("Unserializable return value"),[Va]:0});n.postMessage(Object.assign(Object.assign({},T),{id:c}),R)})}),n.start&&n.start()}function tp(s){return s.constructor.name==="MessagePort"}function yo(s){tp(s)&&s.close()}function fn(s,n){return yn(s,[],n)}function Ya(s){if(s)throw new Error("Proxy has been released and is not useable")}function ho(s){return Or(s,{type:"RELEASE"}).then(()=>{yo(s)})}const Ka=new WeakMap,Qa="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const n=(Ka.get(s)||0)-1;Ka.set(s,n),n===0&&ho(s)});function rp(s,n){const a=(Ka.get(n)||0)+1;Ka.set(n,a),Qa&&Qa.register(s,n,s)}function ap(s){Qa&&Qa.unregister(s)}function yn(s,n=[],a=function(){}){let o=!1;const u=new Proxy(a,{get(c,m){if(Ya(o),m===Qd)return()=>{ap(u),ho(s),o=!0};if(m==="then"){if(n.length===0)return{then:()=>u};const h=Or(s,{type:"GET",path:n.map(b=>b.toString())}).then(_r);return h.then.bind(h)}return yn(s,[...n,m])},set(c,m,h){Ya(o);const[b,g]=Ja(h);return Or(s,{type:"SET",path:[...n,m].map(x=>x.toString()),value:b},g).then(_r)},apply(c,m,h){Ya(o);const b=n[n.length-1];if(b===Kd)return Or(s,{type:"ENDPOINT"}).then(_r);if(b==="bind")return yn(s,n.slice(0,-1));const[g,x]=_o(h);return Or(s,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:g},x).then(_r)},construct(c,m){Ya(o);const[h,b]=_o(m);return Or(s,{type:"CONSTRUCT",path:n.map(g=>g.toString()),argumentList:h},b).then(_r)}});return rp(u,s),u}function sp(s){return Array.prototype.concat.apply([],s)}function _o(s){const n=s.map(Ja);return[n.map(a=>a[0]),sp(n.map(a=>a[1]))]}const go=new WeakMap;function np(s,n){return go.set(s,n),s}function ip(s){return Object.assign(s,{[uo]:!0})}function Ja(s){for(const[n,a]of mo)if(a.canHandle(s)){const[o,u]=a.serialize(s);return[{type:"HANDLER",name:n,value:o},u]}return[{type:"RAW",value:s},go.get(s)||[]]}function _r(s){switch(s.type){case"HANDLER":return mo.get(s.name).deserialize(s.value);case"RAW":return s.value}}function Or(s,n,a){return new Promise(o=>{const u=op();s.addEventListener("message",function c(m){!m.data||!m.data.id||m.data.id!==u||(s.removeEventListener("message",c),o(m.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:u},n),a)})}function op(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const bo=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-CTlk4g3L.js").href:new URL("assets/scriptsRunWorker-CTlk4g3L.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:ja&&ja.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});bo.onerror=s=>{console.error(s)};const xo=fn(bo),lp=fn(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-CHJsIhut.js").href:new URL("assets/parserTccWorker-CHJsIhut.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:ja&&ja.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function wo(s,n=!1){const{functions:a,types:o,constants:u,variables:c,methods:m}=gt;return await lp(s,n,{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(u),variables:Object.fromEntries(c)})}async function vo(s,n,a=!0){return await xo.runScript(s,n,a)}async function cp(s){return await xo.removeScript(s)}function up(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})}C.VType=void 0,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"}(C.VType||(C.VType={})),C.VRuleType=void 0,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"}(C.VRuleType||(C.VRuleType={})),C.VAdjustment=void 0,function(s){s.dividends="dividends",s.none="none",s.splits="splits"}(C.VAdjustment||(C.VAdjustment={})),C.VAlert=void 0,function(s){s.freqAll="freq_all",s.freqOncePerBar="freq_once_per_bar",s.freqOncePerBarClose="freq_once_per_bar_close"}(C.VAlert||(C.VAlert={})),C.VBarmergeGaps=void 0,function(s){s.gapsOff="gaps_off",s.gapsOn="gaps_on",s.lookaheadOff="lookahead_off",s.lookaheadOn="lookahead_on"}(C.VBarmergeGaps||(C.VBarmergeGaps={})),C.VPlotDisplay=void 0,function(s){s.all="all",s.dataWindow="data_window",s.none="none",s.pane="pane",s.priceScale="price_scale",s.statusLine="status_line"}(C.VPlotDisplay||(C.VPlotDisplay={})),C.VExtend=void 0,function(s){s.both="both",s.left="left",s.none="none",s.right="right"}(C.VExtend||(C.VExtend={})),C.VFormatType=void 0,function(s){s.inherit="inherit",s.mintick="mintick",s.percent="percent",s.price="price",s.volume="volume"}(C.VFormatType||(C.VFormatType={})),C.VHlineStyle=void 0,function(s){s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid"}(C.VHlineStyle||(C.VHlineStyle={})),C.VLabelStyle=void 0,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"}(C.VLabelStyle||(C.VLabelStyle={})),C.VLineStyle=void 0,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"}(C.VLineStyle||(C.VLineStyle={})),C.VLocation=void 0,function(s){s.abovebar="abovebar",s.absolute="absolute",s.belowbar="belowbar",s.bottom="bottom",s.top="top"}(C.VLocation||(C.VLocation={})),C.VSortOrder=void 0,function(s){s.ascending="ascending",s.descending="descending"}(C.VSortOrder||(C.VSortOrder={})),C.VPlotStyle=void 0,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"}(C.VPlotStyle||(C.VPlotStyle={})),C.VPosition=void 0,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"}(C.VPosition||(C.VPosition={})),C.VScale=void 0,function(s){s.left="left",s.none="none",s.right="right"}(C.VScale||(C.VScale={})),C.VSession=void 0,function(s){s.extended="extended",s.regular="regular"}(C.VSession||(C.VSession={})),C.VShape=void 0,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"}(C.VShape||(C.VShape={})),C.VSize=void 0,function(s){s.auto="auto",s.huge="huge",s.large="large",s.normal="normal",s.small="small",s.tiny="tiny"}(C.VSize||(C.VSize={})),C.VStrategy=void 0,function(s){s.cash="cash",s.fixed="fixed",s.percentOfEquity="percent_of_equity"}(C.VStrategy||(C.VStrategy={})),C.VCommission=void 0,function(s){s.cashPerContract="cash_per_contract",s.cashPerOrder="cash_per_order",s.percent="percent"}(C.VCommission||(C.VCommission={})),C.VDirection=void 0,function(s){s.all="all",s.long="long",s.short="short"}(C.VDirection||(C.VDirection={})),C.VOca=void 0,function(s){s.cancel="cancel",s.none="none",s.reduce="reduce"}(C.VOca||(C.VOca={})),C.VText=void 0,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"}(C.VText||(C.VText={})),C.VXloc=void 0,function(s){s.bar_index="bar_index",s.bar_time="bar_time"}(C.VXloc||(C.VXloc={})),C.VYloc=void 0,function(s){s.abovebar="abovebar",s.belowbar="belowbar",s.price="price"}(C.VYloc||(C.VYloc={})),C.VEarnings=void 0,function(s){s.actual="actual",s.estimate="estimate",s.standardized="standardized"}(C.VEarnings||(C.VEarnings={})),C.VPivotType=void 0,function(s){s.traditional="Traditional",s.fibonacci="Fibonacci",s.woodie="Woodie",s.classic="Classic",s.dm="DM",s.camarilla="Camarilla"}(C.VPivotType||(C.VPivotType={})),C.VInputType=void 0,function(s){s.INT="int",s.BOOL="bool",s.TIME="time",s.COLOR="color",s.FLOAT="float",s.PRICE="price",s.SOURCE="source",s.STRING="string",s.SYMBOL="symbol",s.SESSION="session",s.TEXT_AREA="text_area",s.TIMEFRAME="timeframe"}(C.VInputType||(C.VInputType={}));var To;(function(s){s.description="description",s.field="field",s.function="function",s.param="param",s.returns="returns",s.type="type",s.variable="variable"})(To||(To={})),C.VScriptType=void 0,function(s){s.library="library",s.indicator="indicator",s.strategy="strategy"}(C.VScriptType||(C.VScriptType={})),C.VType.SERIES,C.VType.SIMPLE,C.VType.INPUT,C.VType.CONST,C.VType.INT,C.VType.FLOAT,C.VType.BOOL,C.VType.COLOR,C.VType.STRING;const dp={domReadOnly:!0,scrollBeyondLastLine:!1,readOnly:!0,minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1},contextmenu:!1};self.MonacoEnvironment={getWorker(){return new up({name:"Editor Worker"})}},tn.config({monaco:nu});let Io={};const pp=(s,n)=>{const{height:a,width:o,theme:u,options:c,hasDiff:m,readOnly:h,defaultValue:b,onChange:g,onLinkOpen:x,onDeclareConfigChange:T,onCursorPositionChange:R,onActionTrigger:L,onEditorDidMount:j}=s,E=M.useRef(null);M.useImperativeHandle(n,()=>({setOriginalScript(A){var k;(k=E.current)==null||k.setOriginalScript(A)},setScript(A){var k;(k=E.current)==null||k.setValue(A)},gotoLine(){var A;(A=E.current)==null||A.gotoLine()},getEditorLayout(){var A;return(A=E.current)==null?void 0:A.getEditorLayout()},setPosition(A,k){var B;(B=E.current)==null||B.setPosition({column:A,lineNumber:k})},setModelMarkers(A){var k;(k=E.current)==null||k.setModelMarkers(A)}})),M.useEffect(()=>{var A,k;m?(k=E.current)==null||k.addDiffDecorations():(A=E.current)==null||A.removeDiffDecorations()},[m]),M.useEffect(()=>{var A;(A=E.current)==null||A.updateActionTrigger(L)},[L]),M.useEffect(()=>{var A;x&&((A=E.current)==null||A.addLinkOpenFunc(x))},[x]),M.useEffect(()=>{var A;a&&((A=E.current)==null||A.setEditorLayout(Number(a)))},[a,E.current]);function V(A,k){var H,le,ie;St.initBuiltinsTrees(),E.current=new Yd(A,k,L),x&&((H=E.current)==null||H.addLinkOpenFunc(x)),m&&((le=E.current)==null||le.addDiffDecorations()),Id(A),(ie=E.current)==null||ie.setEditorLayout(Number(a));const B=A.getValue();E.current.onChangeCursorPosition(R),g&&g(B),!h&&Z(B),j&&j()}const Z=M.useCallback(async A=>{var lt;const k=Date.now(),{errors:B,functions:H,methods:le,types:ie,variables:ce,overloadsFuncs:bt,preParserCode:xt}=await wo(A,!0),Me=new Map(Object.entries(H)),Fe=new Map(Object.entries(le)),Y=new Map(Object.entries(ie)),he=new Map(Object.entries(ce));Nr.setUserDefined({functions:Me,methods:Fe,types:Y,variables:he},bt),St.setUserDefind(Me,Y,he,Fe);const Oe=B.map(je=>({...je,severity:je.type||qe.MarkerSeverity.Error}));if(h)return;try{if(!B.length&&xt){const je=await vo(xt,{isPreParser:!0});so.isEqual(je,Io)||(Io=je,T&&T(je))}}catch(je){console.log(je,"==================error- Run TccScript Server"),B.push({message:`Runtime Error: ${je.message}`,startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0})}(lt=E.current)==null||lt.setModelMarkers(Oe);const Le=Date.now();console.log((Le-k)/1e3)},[T,h]),G=M.useMemo(()=>so.debounce(Z,1500),[Z]);function F(A){var k;if(h){Z(A||"");return}(k=E.current)==null||k.setModelMarkers([]),A!==void 0&&(g&&g(A),G(A))}return P.jsx(fd,{height:a,width:o||"100%",defaultLanguage:Re,defaultValue:b||`indicator("我的脚本")
138
+ */const uo=Symbol("Comlink.proxy"),Kd=Symbol("Comlink.endpoint"),Qd=Symbol("Comlink.releaseProxy"),mn=Symbol("Comlink.finalizer"),Va=Symbol("Comlink.thrown"),po=s=>typeof s=="object"&&s!==null||typeof s=="function",Jd={canHandle:s=>po(s)&&s[uo],serialize(s){const{port1:n,port2:a}=new MessageChannel;return fo(s,n),[a,[a]]},deserialize(s){return s.start(),fn(s)}},Zd={canHandle:s=>po(s)&&Va in s,serialize({value:s}){let n;return s instanceof Error?n={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:n={isError:!1,value:s},[n,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},mo=new Map([["proxy",Jd],["throw",Zd]]);function ep(s,n){for(const a of s)if(n===a||a==="*"||a instanceof RegExp&&a.test(n))return!0;return!1}function fo(s,n=globalThis,a=["*"]){n.addEventListener("message",function o(u){if(!u||!u.data)return;if(!ep(a,u.origin)){console.warn(`Invalid origin '${u.origin}' for comlink proxy`);return}const{id:c,type:m,path:h}=Object.assign({path:[]},u.data),b=(u.data.argumentList||[]).map(_r);let g;try{const x=h.slice(0,-1).reduce((R,L)=>R[L],s),T=h.reduce((R,L)=>R[L],s);switch(m){case"GET":g=T;break;case"SET":x[h.slice(-1)[0]]=_r(u.data.value),g=!0;break;case"APPLY":g=T.apply(x,b);break;case"CONSTRUCT":{const R=new T(...b);g=ip(R)}break;case"ENDPOINT":{const{port1:R,port2:L}=new MessageChannel;fo(s,L),g=np(R,[R])}break;case"RELEASE":g=void 0;break;default:return}}catch(x){g={value:x,[Va]:0}}Promise.resolve(g).catch(x=>({value:x,[Va]:0})).then(x=>{const[T,R]=Ja(x);n.postMessage(Object.assign(Object.assign({},T),{id:c}),R),m==="RELEASE"&&(n.removeEventListener("message",o),yo(n),mn in s&&typeof s[mn]=="function"&&s[mn]())}).catch(x=>{const[T,R]=Ja({value:new TypeError("Unserializable return value"),[Va]:0});n.postMessage(Object.assign(Object.assign({},T),{id:c}),R)})}),n.start&&n.start()}function tp(s){return s.constructor.name==="MessagePort"}function yo(s){tp(s)&&s.close()}function fn(s,n){return yn(s,[],n)}function Ya(s){if(s)throw new Error("Proxy has been released and is not useable")}function ho(s){return Or(s,{type:"RELEASE"}).then(()=>{yo(s)})}const Ka=new WeakMap,Qa="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const n=(Ka.get(s)||0)-1;Ka.set(s,n),n===0&&ho(s)});function rp(s,n){const a=(Ka.get(n)||0)+1;Ka.set(n,a),Qa&&Qa.register(s,n,s)}function ap(s){Qa&&Qa.unregister(s)}function yn(s,n=[],a=function(){}){let o=!1;const u=new Proxy(a,{get(c,m){if(Ya(o),m===Qd)return()=>{ap(u),ho(s),o=!0};if(m==="then"){if(n.length===0)return{then:()=>u};const h=Or(s,{type:"GET",path:n.map(b=>b.toString())}).then(_r);return h.then.bind(h)}return yn(s,[...n,m])},set(c,m,h){Ya(o);const[b,g]=Ja(h);return Or(s,{type:"SET",path:[...n,m].map(x=>x.toString()),value:b},g).then(_r)},apply(c,m,h){Ya(o);const b=n[n.length-1];if(b===Kd)return Or(s,{type:"ENDPOINT"}).then(_r);if(b==="bind")return yn(s,n.slice(0,-1));const[g,x]=_o(h);return Or(s,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:g},x).then(_r)},construct(c,m){Ya(o);const[h,b]=_o(m);return Or(s,{type:"CONSTRUCT",path:n.map(g=>g.toString()),argumentList:h},b).then(_r)}});return rp(u,s),u}function sp(s){return Array.prototype.concat.apply([],s)}function _o(s){const n=s.map(Ja);return[n.map(a=>a[0]),sp(n.map(a=>a[1]))]}const go=new WeakMap;function np(s,n){return go.set(s,n),s}function ip(s){return Object.assign(s,{[uo]:!0})}function Ja(s){for(const[n,a]of mo)if(a.canHandle(s)){const[o,u]=a.serialize(s);return[{type:"HANDLER",name:n,value:o},u]}return[{type:"RAW",value:s},go.get(s)||[]]}function _r(s){switch(s.type){case"HANDLER":return mo.get(s.name).deserialize(s.value);case"RAW":return s.value}}function Or(s,n,a){return new Promise(o=>{const u=op();s.addEventListener("message",function c(m){!m.data||!m.data.id||m.data.id!==u||(s.removeEventListener("message",c),o(m.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:u},n),a)})}function op(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const bo=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-B8F9UHxw.js").href:new URL("assets/scriptsRunWorker-B8F9UHxw.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:ja&&ja.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});bo.onerror=s=>{console.error(s)};const xo=fn(bo),lp=fn(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-CHJsIhut.js").href:new URL("assets/parserTccWorker-CHJsIhut.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:ja&&ja.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function wo(s,n=!1){const{functions:a,types:o,constants:u,variables:c,methods:m}=gt;return await lp(s,n,{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(u),variables:Object.fromEntries(c)})}async function vo(s,n,a=!0){return await xo.runScript(s,n,a)}async function cp(s){return await xo.removeScript(s)}function up(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})}C.VType=void 0,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"}(C.VType||(C.VType={})),C.VRuleType=void 0,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"}(C.VRuleType||(C.VRuleType={})),C.VAdjustment=void 0,function(s){s.dividends="dividends",s.none="none",s.splits="splits"}(C.VAdjustment||(C.VAdjustment={})),C.VAlert=void 0,function(s){s.freqAll="freq_all",s.freqOncePerBar="freq_once_per_bar",s.freqOncePerBarClose="freq_once_per_bar_close"}(C.VAlert||(C.VAlert={})),C.VBarmergeGaps=void 0,function(s){s.gapsOff="gaps_off",s.gapsOn="gaps_on",s.lookaheadOff="lookahead_off",s.lookaheadOn="lookahead_on"}(C.VBarmergeGaps||(C.VBarmergeGaps={})),C.VPlotDisplay=void 0,function(s){s.all="all",s.dataWindow="data_window",s.none="none",s.pane="pane",s.priceScale="price_scale",s.statusLine="status_line"}(C.VPlotDisplay||(C.VPlotDisplay={})),C.VExtend=void 0,function(s){s.both="both",s.left="left",s.none="none",s.right="right"}(C.VExtend||(C.VExtend={})),C.VFormatType=void 0,function(s){s.inherit="inherit",s.mintick="mintick",s.percent="percent",s.price="price",s.volume="volume"}(C.VFormatType||(C.VFormatType={})),C.VHlineStyle=void 0,function(s){s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid"}(C.VHlineStyle||(C.VHlineStyle={})),C.VLabelStyle=void 0,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"}(C.VLabelStyle||(C.VLabelStyle={})),C.VLineStyle=void 0,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"}(C.VLineStyle||(C.VLineStyle={})),C.VLocation=void 0,function(s){s.abovebar="abovebar",s.absolute="absolute",s.belowbar="belowbar",s.bottom="bottom",s.top="top"}(C.VLocation||(C.VLocation={})),C.VSortOrder=void 0,function(s){s.ascending="ascending",s.descending="descending"}(C.VSortOrder||(C.VSortOrder={})),C.VPlotStyle=void 0,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"}(C.VPlotStyle||(C.VPlotStyle={})),C.VPosition=void 0,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"}(C.VPosition||(C.VPosition={})),C.VScale=void 0,function(s){s.left="left",s.none="none",s.right="right"}(C.VScale||(C.VScale={})),C.VSession=void 0,function(s){s.extended="extended",s.regular="regular"}(C.VSession||(C.VSession={})),C.VShape=void 0,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"}(C.VShape||(C.VShape={})),C.VSize=void 0,function(s){s.auto="auto",s.huge="huge",s.large="large",s.normal="normal",s.small="small",s.tiny="tiny"}(C.VSize||(C.VSize={})),C.VStrategy=void 0,function(s){s.cash="cash",s.fixed="fixed",s.percentOfEquity="percent_of_equity"}(C.VStrategy||(C.VStrategy={})),C.VCommission=void 0,function(s){s.cashPerContract="cash_per_contract",s.cashPerOrder="cash_per_order",s.percent="percent"}(C.VCommission||(C.VCommission={})),C.VDirection=void 0,function(s){s.all="all",s.long="long",s.short="short"}(C.VDirection||(C.VDirection={})),C.VOca=void 0,function(s){s.cancel="cancel",s.none="none",s.reduce="reduce"}(C.VOca||(C.VOca={})),C.VText=void 0,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"}(C.VText||(C.VText={})),C.VXloc=void 0,function(s){s.bar_index="bar_index",s.bar_time="bar_time"}(C.VXloc||(C.VXloc={})),C.VYloc=void 0,function(s){s.abovebar="abovebar",s.belowbar="belowbar",s.price="price"}(C.VYloc||(C.VYloc={})),C.VEarnings=void 0,function(s){s.actual="actual",s.estimate="estimate",s.standardized="standardized"}(C.VEarnings||(C.VEarnings={})),C.VPivotType=void 0,function(s){s.traditional="Traditional",s.fibonacci="Fibonacci",s.woodie="Woodie",s.classic="Classic",s.dm="DM",s.camarilla="Camarilla"}(C.VPivotType||(C.VPivotType={})),C.VInputType=void 0,function(s){s.INT="int",s.BOOL="bool",s.TIME="time",s.COLOR="color",s.FLOAT="float",s.PRICE="price",s.SOURCE="source",s.STRING="string",s.SYMBOL="symbol",s.SESSION="session",s.TEXT_AREA="text_area",s.TIMEFRAME="timeframe"}(C.VInputType||(C.VInputType={}));var To;(function(s){s.description="description",s.field="field",s.function="function",s.param="param",s.returns="returns",s.type="type",s.variable="variable"})(To||(To={})),C.VScriptType=void 0,function(s){s.library="library",s.indicator="indicator",s.strategy="strategy"}(C.VScriptType||(C.VScriptType={})),C.VType.SERIES,C.VType.SIMPLE,C.VType.INPUT,C.VType.CONST,C.VType.INT,C.VType.FLOAT,C.VType.BOOL,C.VType.COLOR,C.VType.STRING;const dp={domReadOnly:!0,scrollBeyondLastLine:!1,readOnly:!0,minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1},contextmenu:!1};self.MonacoEnvironment={getWorker(){return new up({name:"Editor Worker"})}},tn.config({monaco:nu});let Io={};const pp=(s,n)=>{const{height:a,width:o,theme:u,options:c,hasDiff:m,readOnly:h,defaultValue:b,onChange:g,onLinkOpen:x,onDeclareConfigChange:T,onCursorPositionChange:R,onActionTrigger:L,onEditorDidMount:j}=s,E=M.useRef(null);M.useImperativeHandle(n,()=>({setOriginalScript(A){var k;(k=E.current)==null||k.setOriginalScript(A)},setScript(A){var k;(k=E.current)==null||k.setValue(A)},gotoLine(){var A;(A=E.current)==null||A.gotoLine()},getEditorLayout(){var A;return(A=E.current)==null?void 0:A.getEditorLayout()},setPosition(A,k){var B;(B=E.current)==null||B.setPosition({column:A,lineNumber:k})},setModelMarkers(A){var k;(k=E.current)==null||k.setModelMarkers(A)}})),M.useEffect(()=>{var A,k;m?(k=E.current)==null||k.addDiffDecorations():(A=E.current)==null||A.removeDiffDecorations()},[m]),M.useEffect(()=>{var A;(A=E.current)==null||A.updateActionTrigger(L)},[L]),M.useEffect(()=>{var A;x&&((A=E.current)==null||A.addLinkOpenFunc(x))},[x]),M.useEffect(()=>{var A;a&&((A=E.current)==null||A.setEditorLayout(Number(a)))},[a,E.current]);function V(A,k){var H,le,ie;St.initBuiltinsTrees(),E.current=new Yd(A,k,L),x&&((H=E.current)==null||H.addLinkOpenFunc(x)),m&&((le=E.current)==null||le.addDiffDecorations()),Id(A),(ie=E.current)==null||ie.setEditorLayout(Number(a));const B=A.getValue();E.current.onChangeCursorPosition(R),g&&g(B),!h&&Z(B),j&&j()}const Z=M.useCallback(async A=>{var lt;const k=Date.now(),{errors:B,functions:H,methods:le,types:ie,variables:ce,overloadsFuncs:bt,preParserCode:xt}=await wo(A,!0),Me=new Map(Object.entries(H)),Fe=new Map(Object.entries(le)),Y=new Map(Object.entries(ie)),he=new Map(Object.entries(ce));Nr.setUserDefined({functions:Me,methods:Fe,types:Y,variables:he},bt),St.setUserDefind(Me,Y,he,Fe);const Oe=B.map(je=>({...je,severity:je.type||qe.MarkerSeverity.Error}));if(h)return;try{if(!B.length&&xt){const je=await vo(xt,{isPreParser:!0});so.isEqual(je,Io)||(Io=je,T&&T(je))}}catch(je){console.log(je,"==================error- Run TccScript Server"),B.push({message:`Runtime Error: ${je.message}`,startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0})}(lt=E.current)==null||lt.setModelMarkers(Oe);const Le=Date.now();console.log((Le-k)/1e3)},[T,h]),G=M.useMemo(()=>so.debounce(Z,1500),[Z]);function F(A){var k;if(h){Z(A||"");return}(k=E.current)==null||k.setModelMarkers([]),A!==void 0&&(g&&g(A),G(A))}return P.jsx(fd,{height:a,width:o||"100%",defaultLanguage:Re,defaultValue:b||`indicator("我的脚本")
139
139
  plot(close)
140
140
  `,theme:u||"vs-dark",className:`tvue-script ${u||"vs-dark"}`,options:{colorDecorators:!0,useShadowDOM:!1,matchOnWordStartOnly:!0,suggest:{filterGraceful:!0},fontSize:13,...h?dp:{},readOnlyMessage:{value:"该脚本是只读的。它无法被编辑。"},...c},onMount:V,onChange:F})},mp=M.forwardRef(pp),fp=s=>{const{theme:n,modified:a,original:o,height:u,width:c,renderSideBySide:m=!0}=s,h=M.useCallback((b,g)=>{g.languages.register({id:Re}),g.editor.defineTheme("vs-dark",ln),g.editor.defineTheme("vs",on),g.languages.setMonarchTokensProvider(Re,sn),g.languages.setLanguageConfiguration(Re,nn)},[]);return P.jsx(cd,{height:u||"90vh",width:c||"100%",theme:n||"vs-dark",options:{readOnly:!0,renderSideBySide:m,scrollBeyondLastLine:!1},language:Re,modified:a,original:o,onMount:h})};C.VMarkerSeverity=void 0,function(s){s[s.Hint=1]="Hint",s[s.Info=2]="Info",s[s.Warning=4]="Warning",s[s.Error=8]="Error"}(C.VMarkerSeverity||(C.VMarkerSeverity={}));var Za={},yp=function(){var s=document.getSelection();if(!s.rangeCount)return function(){};for(var n=document.activeElement,a=[],o=0;o<s.rangeCount;o++)a.push(s.getRangeAt(o));switch(n.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":n.blur();break;default:n=null;break}return s.removeAllRanges(),function(){s.type==="Caret"&&s.removeAllRanges(),s.rangeCount||a.forEach(function(u){s.addRange(u)}),n&&n.focus()}},hp=yp,ko={"text/plain":"Text","text/html":"Url",default:"Text"},_p="Copy to clipboard: #{key}, Enter";function gp(s){var n=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return s.replace(/#{\s*key\s*}/g,n)}function bp(s,n){var a,o,u,c,m,h,b=!1;n||(n={}),a=n.debug||!1;try{u=hp(),c=document.createRange(),m=document.getSelection(),h=document.createElement("span"),h.textContent=s,h.ariaHidden="true",h.style.all="unset",h.style.position="fixed",h.style.top=0,h.style.clip="rect(0, 0, 0, 0)",h.style.whiteSpace="pre",h.style.webkitUserSelect="text",h.style.MozUserSelect="text",h.style.msUserSelect="text",h.style.userSelect="text",h.addEventListener("copy",function(x){if(x.stopPropagation(),n.format)if(x.preventDefault(),typeof x.clipboardData>"u"){a&&console.warn("unable to use e.clipboardData"),a&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var T=ko[n.format]||ko.default;window.clipboardData.setData(T,s)}else x.clipboardData.clearData(),x.clipboardData.setData(n.format,s);n.onCopy&&(x.preventDefault(),n.onCopy(x.clipboardData))}),document.body.appendChild(h),c.selectNodeContents(h),m.addRange(c);var g=document.execCommand("copy");if(!g)throw new Error("copy command was unsuccessful");b=!0}catch(x){a&&console.error("unable to copy using execCommand: ",x),a&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(n.format||"text",s),n.onCopy&&n.onCopy(window.clipboardData),b=!0}catch(T){a&&console.error("unable to copy using clipboardData: ",T),a&&console.error("falling back to prompt"),o=gp("message"in n?n.message:_p),window.prompt(o,s)}}finally{m&&(typeof m.removeRange=="function"?m.removeRange(c):m.removeAllRanges()),h&&document.body.removeChild(h),u()}return b}var xp=bp;function hn(s){"@babel/helpers - typeof";return hn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},hn(s)}Object.defineProperty(Za,"__esModule",{value:!0}),Za.CopyToClipboard=void 0;var es=Do(M),wp=Do(xp),vp=["text","onCopy","options","children"];function Do(s){return s&&s.__esModule?s:{default:s}}function Ao(s,n){var a=Object.keys(s);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(s);n&&(o=o.filter(function(u){return Object.getOwnPropertyDescriptor(s,u).enumerable})),a.push.apply(a,o)}return a}function qo(s){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?Ao(Object(a),!0).forEach(function(o){gn(s,o,a[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):Ao(Object(a)).forEach(function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(a,o))})}return s}function Tp(s,n){if(s==null)return{};var a=Ip(s,n),o,u;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(s);for(u=0;u<c.length;u++)o=c[u],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(s,o)&&(a[o]=s[o])}return a}function Ip(s,n){if(s==null)return{};var a={},o=Object.keys(s),u,c;for(c=0;c<o.length;c++)u=o[c],!(n.indexOf(u)>=0)&&(a[u]=s[u]);return a}function kp(s,n){if(!(s instanceof n))throw new TypeError("Cannot call a class as a function")}function Co(s,n){for(var a=0;a<n.length;a++){var o=n[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(s,o.key,o)}}function Dp(s,n,a){return n&&Co(s.prototype,n),a&&Co(s,a),Object.defineProperty(s,"prototype",{writable:!1}),s}function Ap(s,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(n&&n.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),n&&_n(s,n)}function _n(s,n){return _n=Object.setPrototypeOf||function(o,u){return o.__proto__=u,o},_n(s,n)}function qp(s){var n=Sp();return function(){var o=ts(s),u;if(n){var c=ts(this).constructor;u=Reflect.construct(o,arguments,c)}else u=o.apply(this,arguments);return Cp(this,u)}}function Cp(s,n){if(n&&(hn(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return So(s)}function So(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Sp(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ts(s){return ts=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},ts(s)}function gn(s,n,a){return n in s?Object.defineProperty(s,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[n]=a,s}var zo=function(s){Ap(a,s);var n=qp(a);function a(){var o;kp(this,a);for(var u=arguments.length,c=new Array(u),m=0;m<u;m++)c[m]=arguments[m];return o=n.call.apply(n,[this].concat(c)),gn(So(o),"onClick",function(h){var b=o.props,g=b.text,x=b.onCopy,T=b.children,R=b.options,L=es.default.Children.only(T),j=(0,wp.default)(g,R);x&&x(g,j),L&&L.props&&typeof L.props.onClick=="function"&&L.props.onClick(h)}),o}return Dp(a,[{key:"render",value:function(){var u=this.props;u.text,u.onCopy,u.options;var c=u.children,m=Tp(u,vp),h=es.default.Children.only(c);return es.default.cloneElement(h,qo(qo({},m),{},{onClick:this.onClick}))}}]),a}(es.default.PureComponent);Za.CopyToClipboard=zo,gn(zo,"defaultProps",{onCopy:void 0,options:void 0});var zp=Za,bn=zp.CopyToClipboard;bn.CopyToClipboard=bn;var Np=bn;const xn=iu(Np);async function Op(s,n=0){const a=s[n];if(!a)return;const{name:o,args:u,type:c,desc:m,examples:h,remarks:b,seeAlso:g,syntax:x,detailedDesc:T,fields:R,returns:L}=a,j={name:o};if(s.length>1&&(j.overloads=`${s.length} overloads`),c&&(j.type=c),u&&(j.name=`${o}()`,j.args=u.map(E=>{const{name:V,desc:Z,displayType:G}=E;return{label:`${V} (${G})`,desc:Z&&gr(Z)}})),m&&(j.desc=m.map(E=>gr(E))),h&&(j.originalExample=h.join(`
141
141
  `),j.examples=await qe.editor.colorize(j.originalExample,Re,{tabSize:4})),T){j.detailedDesc=[];for(const E of T){const{desc:V,examples:Z}=E;let G=V.map(k=>gr(k)),F,A;Z&&(A=Z.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guihz/trading-vue-editor-tes",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "lib"