@guihz/trading-vue-editor-tes 0.0.66 → 0.0.68

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,6 +33,7 @@ export default class ParserVisitor extends ParserUtils {
33
33
  private _importLibs;
34
34
  private _getImportLibraryFunc;
35
35
  private _isEndExpr?;
36
+ private _inputVarName?;
36
37
  constructor(props: IKeyObjectValue, comments: IKeyObjectValue[], getImportLibraryFunc: (obj: IKeyObjectValue) => IKeyObjectValue);
37
38
  get overloadsFuncs(): IKeyValue[];
38
39
  get errors(): IError[];
@@ -161,6 +162,7 @@ export default class ParserVisitor extends ParserUtils {
161
162
  type: any;
162
163
  exprs: any[];
163
164
  };
165
+ private _inputFuncTitleVerify;
164
166
  visitMethodExpression: (ctx: IKeyObjectValue) => any;
165
167
  visitLogicalAndExpression: (ctx: IKeyObjectValue) => {
166
168
  ruleType: VRuleType;
@@ -67212,14 +67212,14 @@ function rr(a, n, r) {
67212
67212
  function ox() {
67213
67213
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
67214
67214
  }
67215
- const Lu = new Worker(new URL("" + new URL("assets/scriptsRunWorker-D39bcXaY.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
67215
+ const Lu = new Worker(new URL("" + new URL("assets/scriptsRunWorker-3EMpbGaS.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
67216
67216
  Lu.onerror = (a) => {
67217
67217
  console.error(a);
67218
67218
  };
67219
67219
  async function Mu(a) {
67220
67220
  return await an.setInlayHints(a);
67221
67221
  }
67222
- const Fu = Hi(Lu), ju = Hi(new Worker(new URL("" + new URL("assets/parserTccWorker-DoXo8HMM.js", import.meta.url).href, import.meta.url), { type: "module", name: "Parser TccScript Server" }));
67222
+ const Fu = Hi(Lu), ju = Hi(new Worker(new URL("" + new URL("assets/parserTccWorker-B1fH-Qn3.js", import.meta.url).href, import.meta.url), { type: "module", name: "Parser TccScript Server" }));
67223
67223
  async function lx(a, n = !1) {
67224
67224
  const { functions: r, types: o, constants: c, variables: l, methods: m } = _t;
67225
67225
  return an.clearInlayHints(), await ju.parseTcc(a, n, $i(Mu), { functions: Object.fromEntries(r), methods: Object.fromEntries(m), types: Object.fromEntries(o), constants: Object.fromEntries(c), variables: Object.fromEntries(l) });
@@ -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 yo=Symbol("Comlink.proxy"),np=Symbol("Comlink.endpoint"),ip=Symbol("Comlink.releaseProxy"),fn=Symbol("Comlink.finalizer"),Ka=Symbol("Comlink.thrown"),ho=s=>typeof s=="object"&&s!==null||typeof s=="function",op={canHandle:s=>ho(s)&&s[yo],serialize(s){const{port1:n,port2:a}=new MessageChannel;return go(s,n),[a,[a]]},deserialize(s){return s.start(),yn(s)}},lp={canHandle:s=>ho(s)&&Ka 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}},_o=new Map([["proxy",op],["throw",lp]]);function cp(s,n){for(const a of s)if(n===a||a==="*"||a instanceof RegExp&&a.test(n))return!0;return!1}function go(s,n=globalThis,a=["*"]){n.addEventListener("message",function o(c){if(!c||!c.data)return;if(!cp(a,c.origin)){console.warn(`Invalid origin '${c.origin}' for comlink proxy`);return}const{id:l,type:m,path:h}=Object.assign({path:[]},c.data),b=(c.data.argumentList||[]).map(_r);let _;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":_=T;break;case"SET":x[h.slice(-1)[0]]=_r(c.data.value),_=!0;break;case"APPLY":_=T.apply(x,b);break;case"CONSTRUCT":{const R=new T(...b);_=_n(R)}break;case"ENDPOINT":{const{port1:R,port2:L}=new MessageChannel;go(s,L),_=fp(R,[R])}break;case"RELEASE":_=void 0;break;default:return}}catch(x){_={value:x,[Ka]:0}}Promise.resolve(_).catch(x=>({value:x,[Ka]:0})).then(x=>{const[T,R]=es(x);n.postMessage(Object.assign(Object.assign({},T),{id:l}),R),m==="RELEASE"&&(n.removeEventListener("message",o),bo(n),fn in s&&typeof s[fn]=="function"&&s[fn]())}).catch(x=>{const[T,R]=es({value:new TypeError("Unserializable return value"),[Ka]:0});n.postMessage(Object.assign(Object.assign({},T),{id:l}),R)})}),n.start&&n.start()}function up(s){return s.constructor.name==="MessagePort"}function bo(s){up(s)&&s.close()}function yn(s,n){return hn(s,[],n)}function Qa(s){if(s)throw new Error("Proxy has been released and is not useable")}function xo(s){return Pr(s,{type:"RELEASE"}).then(()=>{bo(s)})}const Za=new WeakMap,Ja="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const n=(Za.get(s)||0)-1;Za.set(s,n),n===0&&xo(s)});function dp(s,n){const a=(Za.get(n)||0)+1;Za.set(n,a),Ja&&Ja.register(s,n,s)}function pp(s){Ja&&Ja.unregister(s)}function hn(s,n=[],a=function(){}){let o=!1;const c=new Proxy(a,{get(l,m){if(Qa(o),m===ip)return()=>{pp(c),xo(s),o=!0};if(m==="then"){if(n.length===0)return{then:()=>c};const h=Pr(s,{type:"GET",path:n.map(b=>b.toString())}).then(_r);return h.then.bind(h)}return hn(s,[...n,m])},set(l,m,h){Qa(o);const[b,_]=es(h);return Pr(s,{type:"SET",path:[...n,m].map(x=>x.toString()),value:b},_).then(_r)},apply(l,m,h){Qa(o);const b=n[n.length-1];if(b===np)return Pr(s,{type:"ENDPOINT"}).then(_r);if(b==="bind")return hn(s,n.slice(0,-1));const[_,x]=wo(h);return Pr(s,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:_},x).then(_r)},construct(l,m){Qa(o);const[h,b]=wo(m);return Pr(s,{type:"CONSTRUCT",path:n.map(_=>_.toString()),argumentList:h},b).then(_r)}});return dp(c,s),c}function mp(s){return Array.prototype.concat.apply([],s)}function wo(s){const n=s.map(es);return[n.map(a=>a[0]),mp(n.map(a=>a[1]))]}const vo=new WeakMap;function fp(s,n){return vo.set(s,n),s}function _n(s){return Object.assign(s,{[yo]:!0})}function es(s){for(const[n,a]of _o)if(a.canHandle(s)){const[o,c]=a.serialize(s);return[{type:"HANDLER",name:n,value:o},c]}return[{type:"RAW",value:s},vo.get(s)||[]]}function _r(s){switch(s.type){case"HANDLER":return _o.get(s.name).deserialize(s.value);case"RAW":return s.value}}function Pr(s,n,a){return new Promise(o=>{const c=yp();s.addEventListener("message",function l(m){!m.data||!m.data.id||m.data.id!==c||(s.removeEventListener("message",l),o(m.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:c},n),a)})}function yp(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const To=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-D39bcXaY.js").href:new URL("assets/scriptsRunWorker-D39bcXaY.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:Ba&&Ba.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});To.onerror=s=>{console.error(s)};async function Io(s){return await Xa.setInlayHints(s)}const ko=yn(To),Do=yn(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-DoXo8HMM.js").href:new URL("assets/parserTccWorker-DoXo8HMM.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:Ba&&Ba.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function Ao(s,n=!1){const{functions:a,types:o,constants:c,variables:l,methods:m}=lt;return Xa.clearInlayHints(),await Do.parseTcc(s,n,_n(Io),{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function hp(s,n){const{functions:a,types:o,constants:c,variables:l,methods:m}=lt;return await Do.parseLibraryCode(s,n,_n(Io),{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function qo(s,n,a=!0){return await ko.runScript(s,n,a)}async function _p(s){return await ko.removeScript(s)}function gp(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})}self.MonacoEnvironment={getWorker(){return new gp({name:"Editor Worker"})}},an.config({monaco:uu});let Co={};const bp=(s,n)=>{const{height:a,width:o,theme:c,options:l,hasDiff:m,readOnly:h,defaultValue:b,onChange:_,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 G(A,k){var H,le,ie;qt.initBuiltinsTrees(),Xa.setEditor(A),E.current=new sp(A,k,L),x&&((H=E.current)==null||H.addLinkOpenFunc(x)),m&&((le=E.current)==null||le.addDiffDecorations()),Sd(A),(ie=E.current)==null||ie.setEditorLayout(Number(a));const B=A.getValue();E.current.onChangeCursorPosition(R),_&&_(B),!h&&J(B),j&&j()}const J=M.useCallback(async A=>{var te;const k=Date.now(),{errors:B,functions:H,methods:le,types:ie,variables:ce,overloadsFuncs:_t,imports:St,preParserCode:Me}=await Ao(A),Fe=new Map(Object.entries(H)),Y=new Map(Object.entries(le)),ge=new Map(Object.entries(ie)),Ne=new Map(Object.entries(ce)),Le=new Map(Object.entries(St));Nr.setUserDefined({functions:Fe,methods:Y,types:ge,variables:Ne,imports:Le},_t),qt.setUserDefind(Fe,ge,Ne,Y);const gt=B.map(de=>({...de,severity:de.type||Ae.MarkerSeverity.Error}));if(h)return;try{if(!B.length&&Me){const de=await qo(Me,{isPreParser:!0});io.isEqual(de,Co)||(Co=de,T&&T(de))}}catch(de){B.push({message:`Runtime Error: ${de.message}`,startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0})}(te=E.current)==null||te.setModelMarkers(gt);const zt=Date.now();console.log((zt-k)/1e3)},[T,h]),X=M.useMemo(()=>io.debounce(J,1500),[J]);function F(A){var k;if(h){J(A||"");return}(k=E.current)==null||k.setModelMarkers([]),A!==void 0&&(_&&_(A),X(A))}return P.jsx(bd,{height:a,width:o||"100%",defaultLanguage:ze,defaultValue:b||`indicator("我的脚本")
138
+ */const yo=Symbol("Comlink.proxy"),np=Symbol("Comlink.endpoint"),ip=Symbol("Comlink.releaseProxy"),fn=Symbol("Comlink.finalizer"),Ka=Symbol("Comlink.thrown"),ho=s=>typeof s=="object"&&s!==null||typeof s=="function",op={canHandle:s=>ho(s)&&s[yo],serialize(s){const{port1:n,port2:a}=new MessageChannel;return go(s,n),[a,[a]]},deserialize(s){return s.start(),yn(s)}},lp={canHandle:s=>ho(s)&&Ka 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}},_o=new Map([["proxy",op],["throw",lp]]);function cp(s,n){for(const a of s)if(n===a||a==="*"||a instanceof RegExp&&a.test(n))return!0;return!1}function go(s,n=globalThis,a=["*"]){n.addEventListener("message",function o(c){if(!c||!c.data)return;if(!cp(a,c.origin)){console.warn(`Invalid origin '${c.origin}' for comlink proxy`);return}const{id:l,type:m,path:h}=Object.assign({path:[]},c.data),b=(c.data.argumentList||[]).map(_r);let _;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":_=T;break;case"SET":x[h.slice(-1)[0]]=_r(c.data.value),_=!0;break;case"APPLY":_=T.apply(x,b);break;case"CONSTRUCT":{const R=new T(...b);_=_n(R)}break;case"ENDPOINT":{const{port1:R,port2:L}=new MessageChannel;go(s,L),_=fp(R,[R])}break;case"RELEASE":_=void 0;break;default:return}}catch(x){_={value:x,[Ka]:0}}Promise.resolve(_).catch(x=>({value:x,[Ka]:0})).then(x=>{const[T,R]=es(x);n.postMessage(Object.assign(Object.assign({},T),{id:l}),R),m==="RELEASE"&&(n.removeEventListener("message",o),bo(n),fn in s&&typeof s[fn]=="function"&&s[fn]())}).catch(x=>{const[T,R]=es({value:new TypeError("Unserializable return value"),[Ka]:0});n.postMessage(Object.assign(Object.assign({},T),{id:l}),R)})}),n.start&&n.start()}function up(s){return s.constructor.name==="MessagePort"}function bo(s){up(s)&&s.close()}function yn(s,n){return hn(s,[],n)}function Qa(s){if(s)throw new Error("Proxy has been released and is not useable")}function xo(s){return Pr(s,{type:"RELEASE"}).then(()=>{bo(s)})}const Za=new WeakMap,Ja="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const n=(Za.get(s)||0)-1;Za.set(s,n),n===0&&xo(s)});function dp(s,n){const a=(Za.get(n)||0)+1;Za.set(n,a),Ja&&Ja.register(s,n,s)}function pp(s){Ja&&Ja.unregister(s)}function hn(s,n=[],a=function(){}){let o=!1;const c=new Proxy(a,{get(l,m){if(Qa(o),m===ip)return()=>{pp(c),xo(s),o=!0};if(m==="then"){if(n.length===0)return{then:()=>c};const h=Pr(s,{type:"GET",path:n.map(b=>b.toString())}).then(_r);return h.then.bind(h)}return hn(s,[...n,m])},set(l,m,h){Qa(o);const[b,_]=es(h);return Pr(s,{type:"SET",path:[...n,m].map(x=>x.toString()),value:b},_).then(_r)},apply(l,m,h){Qa(o);const b=n[n.length-1];if(b===np)return Pr(s,{type:"ENDPOINT"}).then(_r);if(b==="bind")return hn(s,n.slice(0,-1));const[_,x]=wo(h);return Pr(s,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:_},x).then(_r)},construct(l,m){Qa(o);const[h,b]=wo(m);return Pr(s,{type:"CONSTRUCT",path:n.map(_=>_.toString()),argumentList:h},b).then(_r)}});return dp(c,s),c}function mp(s){return Array.prototype.concat.apply([],s)}function wo(s){const n=s.map(es);return[n.map(a=>a[0]),mp(n.map(a=>a[1]))]}const vo=new WeakMap;function fp(s,n){return vo.set(s,n),s}function _n(s){return Object.assign(s,{[yo]:!0})}function es(s){for(const[n,a]of _o)if(a.canHandle(s)){const[o,c]=a.serialize(s);return[{type:"HANDLER",name:n,value:o},c]}return[{type:"RAW",value:s},vo.get(s)||[]]}function _r(s){switch(s.type){case"HANDLER":return _o.get(s.name).deserialize(s.value);case"RAW":return s.value}}function Pr(s,n,a){return new Promise(o=>{const c=yp();s.addEventListener("message",function l(m){!m.data||!m.data.id||m.data.id!==c||(s.removeEventListener("message",l),o(m.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:c},n),a)})}function yp(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const To=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-3EMpbGaS.js").href:new URL("assets/scriptsRunWorker-3EMpbGaS.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:Ba&&Ba.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});To.onerror=s=>{console.error(s)};async function Io(s){return await Xa.setInlayHints(s)}const ko=yn(To),Do=yn(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-B1fH-Qn3.js").href:new URL("assets/parserTccWorker-B1fH-Qn3.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:Ba&&Ba.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function Ao(s,n=!1){const{functions:a,types:o,constants:c,variables:l,methods:m}=lt;return Xa.clearInlayHints(),await Do.parseTcc(s,n,_n(Io),{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function hp(s,n){const{functions:a,types:o,constants:c,variables:l,methods:m}=lt;return await Do.parseLibraryCode(s,n,_n(Io),{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function qo(s,n,a=!0){return await ko.runScript(s,n,a)}async function _p(s){return await ko.removeScript(s)}function gp(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})}self.MonacoEnvironment={getWorker(){return new gp({name:"Editor Worker"})}},an.config({monaco:uu});let Co={};const bp=(s,n)=>{const{height:a,width:o,theme:c,options:l,hasDiff:m,readOnly:h,defaultValue:b,onChange:_,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 G(A,k){var H,le,ie;qt.initBuiltinsTrees(),Xa.setEditor(A),E.current=new sp(A,k,L),x&&((H=E.current)==null||H.addLinkOpenFunc(x)),m&&((le=E.current)==null||le.addDiffDecorations()),Sd(A),(ie=E.current)==null||ie.setEditorLayout(Number(a));const B=A.getValue();E.current.onChangeCursorPosition(R),_&&_(B),!h&&J(B),j&&j()}const J=M.useCallback(async A=>{var te;const k=Date.now(),{errors:B,functions:H,methods:le,types:ie,variables:ce,overloadsFuncs:_t,imports:St,preParserCode:Me}=await Ao(A),Fe=new Map(Object.entries(H)),Y=new Map(Object.entries(le)),ge=new Map(Object.entries(ie)),Ne=new Map(Object.entries(ce)),Le=new Map(Object.entries(St));Nr.setUserDefined({functions:Fe,methods:Y,types:ge,variables:Ne,imports:Le},_t),qt.setUserDefind(Fe,ge,Ne,Y);const gt=B.map(de=>({...de,severity:de.type||Ae.MarkerSeverity.Error}));if(h)return;try{if(!B.length&&Me){const de=await qo(Me,{isPreParser:!0});io.isEqual(de,Co)||(Co=de,T&&T(de))}}catch(de){B.push({message:`Runtime Error: ${de.message}`,startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0})}(te=E.current)==null||te.setModelMarkers(gt);const zt=Date.now();console.log((zt-k)/1e3)},[T,h]),X=M.useMemo(()=>io.debounce(J,1500),[J]);function F(A){var k;if(h){J(A||"");return}(k=E.current)==null||k.setModelMarkers([]),A!==void 0&&(_&&_(A),X(A))}return P.jsx(bd,{height:a,width:o||"100%",defaultLanguage:ze,defaultValue:b||`indicator("我的脚本")
139
139
  plot(close)
140
140
  `,theme:c||"vs-dark",className:`tvue-script ${c||"vs-dark"}`,options:{colorDecorators:!0,useShadowDOM:!1,matchOnWordStartOnly:!0,suggest:{filterGraceful:!0},fontSize:13,...h?Md:{},readOnlyMessage:{value:"该脚本是只读的。它无法被编辑。"},...l},onMount:G,onChange:F})},xp=M.forwardRef(bp),wp=s=>{const{theme:n,modified:a,original:o,height:c,width:l,renderSideBySide:m=!0}=s,h=M.useCallback((b,_)=>{_.languages.register({id:ze}),_.editor.defineTheme("vs-dark",cn),_.editor.defineTheme("vs",ln),_.languages.setMonarchTokensProvider(ze,Or),_.languages.setLanguageConfiguration(ze,on)},[]);return P.jsx(fd,{height:c||"90vh",width:l||"100%",theme:n||"vs-dark",options:{readOnly:!0,renderSideBySide:m,scrollBeyondLastLine:!1},language:ze,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 ts={},vp=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(c){s.addRange(c)}),n&&n.focus()}},Tp=vp,So={"text/plain":"Text","text/html":"Url",default:"Text"},Ip="Copy to clipboard: #{key}, Enter";function kp(s){var n=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return s.replace(/#{\s*key\s*}/g,n)}function Dp(s,n){var a,o,c,l,m,h,b=!1;n||(n={}),a=n.debug||!1;try{c=Tp(),l=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=So[n.format]||So.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),l.selectNodeContents(h),m.addRange(l);var _=document.execCommand("copy");if(!_)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=kp("message"in n?n.message:Ip),window.prompt(o,s)}}finally{m&&(typeof m.removeRange=="function"?m.removeRange(l):m.removeAllRanges()),h&&document.body.removeChild(h),c()}return b}var Ap=Dp;function gn(s){"@babel/helpers - typeof";return gn=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},gn(s)}Object.defineProperty(ts,"__esModule",{value:!0}),ts.CopyToClipboard=void 0;var rs=zo(M),qp=zo(Ap),Cp=["text","onCopy","options","children"];function zo(s){return s&&s.__esModule?s:{default:s}}function No(s,n){var a=Object.keys(s);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(s);n&&(o=o.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),a.push.apply(a,o)}return a}function Oo(s){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?No(Object(a),!0).forEach(function(o){xn(s,o,a[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):No(Object(a)).forEach(function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(a,o))})}return s}function Sp(s,n){if(s==null)return{};var a=zp(s,n),o,c;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);for(c=0;c<l.length;c++)o=l[c],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(s,o)&&(a[o]=s[o])}return a}function zp(s,n){if(s==null)return{};var a={},o=Object.keys(s),c,l;for(l=0;l<o.length;l++)c=o[l],!(n.indexOf(c)>=0)&&(a[c]=s[c]);return a}function Np(s,n){if(!(s instanceof n))throw new TypeError("Cannot call a class as a function")}function Po(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 Op(s,n,a){return n&&Po(s.prototype,n),a&&Po(s,a),Object.defineProperty(s,"prototype",{writable:!1}),s}function Pp(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&&bn(s,n)}function bn(s,n){return bn=Object.setPrototypeOf||function(o,c){return o.__proto__=c,o},bn(s,n)}function Ep(s){var n=Lp();return function(){var o=as(s),c;if(n){var l=as(this).constructor;c=Reflect.construct(o,arguments,l)}else c=o.apply(this,arguments);return Rp(this,c)}}function Rp(s,n){if(n&&(gn(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Eo(s)}function Eo(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Lp(){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 as(s){return as=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},as(s)}function xn(s,n,a){return n in s?Object.defineProperty(s,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[n]=a,s}var Ro=function(s){Pp(a,s);var n=Ep(a);function a(){var o;Np(this,a);for(var c=arguments.length,l=new Array(c),m=0;m<c;m++)l[m]=arguments[m];return o=n.call.apply(n,[this].concat(l)),xn(Eo(o),"onClick",function(h){var b=o.props,_=b.text,x=b.onCopy,T=b.children,R=b.options,L=rs.default.Children.only(T),j=(0,qp.default)(_,R);x&&x(_,j),L&&L.props&&typeof L.props.onClick=="function"&&L.props.onClick(h)}),o}return Op(a,[{key:"render",value:function(){var c=this.props;c.text,c.onCopy,c.options;var l=c.children,m=Sp(c,Cp),h=rs.default.Children.only(l);return rs.default.cloneElement(h,Oo(Oo({},m),{},{onClick:this.onClick}))}}]),a}(rs.default.PureComponent);ts.CopyToClipboard=Ro,xn(Ro,"defaultProps",{onCopy:void 0,options:void 0});var Mp=ts,wn=Mp.CopyToClipboard;wn.CopyToClipboard=wn;var Fp=wn;const vn=du(Fp);async function jp(s,n=0){const a=s[n];if(!a)return;const{name:o,args:c,type:l,desc:m,examples:h,remarks:b,seeAlso:_,syntax:x,detailedDesc:T,fields:R,returns:L}=a,j={name:o};if(s.length>1&&(j.overloads=`${s.length} overloads`),l&&(j.type=l),c&&(j.name=`${o}()`,j.args=c.map(E=>{const{name:G,desc:J,displayType:X}=E;return{label:`${G} (${X})`,desc:J&&gr(J)}})),m&&(j.desc=m.map(E=>gr(E))),h&&(j.originalExample=h.join(`
141
141
  `),j.examples=await Ae.editor.colorize(j.originalExample,ze,{tabSize:4})),T){j.detailedDesc=[];for(const E of T){const{desc:G,examples:J}=E;let X=G.map(k=>gr(k)),F,A;J&&(A=J.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guihz/trading-vue-editor-tes",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "lib"