@guihz/trading-vue-editor-tes 0.1.65 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assets/{scriptsRunWorker-CdLcsxed.js → scriptsRunWorker-BLnTwb2Y.js} +2842 -2802
- package/lib/components/editor/v3/parseScript/buildInVarNamespace/strategy.d.ts +4 -0
- package/lib/components/editor/v4/parseScript/buildInVarNamespace/strategy.d.ts +4 -0
- package/lib/components/editor/v5/parseScript/buildInVarNamespace/strategy.d.ts +4 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/strategy.d.ts +4 -0
- package/lib/trading-vue-editor.es.packages.js +1 -1
- package/lib/trading-vue-editor.umd.packages.mjs +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,8 @@ export declare class Strategy {
|
|
|
11
11
|
private _max_runup;
|
|
12
12
|
private _max_runup_percent;
|
|
13
13
|
private _max_drawdown_percent;
|
|
14
|
+
private _max_net_drawdown;
|
|
15
|
+
private _max_net_drawdown_percent;
|
|
14
16
|
private _variables;
|
|
15
17
|
private _netprofit;
|
|
16
18
|
private _eventrades;
|
|
@@ -102,6 +104,8 @@ export declare class Strategy {
|
|
|
102
104
|
max_runup_percent: number;
|
|
103
105
|
max_drawdown: number;
|
|
104
106
|
max_runup: number;
|
|
107
|
+
max_net_drawdown: number;
|
|
108
|
+
max_net_drawdown_percent: number;
|
|
105
109
|
max_contracts_held_long: number;
|
|
106
110
|
max_contracts_held_short: number;
|
|
107
111
|
max_contracts_held_all: number;
|
|
@@ -11,6 +11,8 @@ export declare class Strategy {
|
|
|
11
11
|
private _max_runup;
|
|
12
12
|
private _max_runup_percent;
|
|
13
13
|
private _max_drawdown_percent;
|
|
14
|
+
private _max_net_drawdown;
|
|
15
|
+
private _max_net_drawdown_percent;
|
|
14
16
|
private _variables;
|
|
15
17
|
private _netprofit;
|
|
16
18
|
private _eventrades;
|
|
@@ -98,6 +100,8 @@ export declare class Strategy {
|
|
|
98
100
|
max_runup_percent: number;
|
|
99
101
|
max_drawdown: number;
|
|
100
102
|
max_runup: number;
|
|
103
|
+
max_net_drawdown: number;
|
|
104
|
+
max_net_drawdown_percent: number;
|
|
101
105
|
max_contracts_held_long: number;
|
|
102
106
|
max_contracts_held_short: number;
|
|
103
107
|
max_contracts_held_all: number;
|
|
@@ -9,6 +9,8 @@ export declare class Strategy {
|
|
|
9
9
|
private _max_contracts_held_short;
|
|
10
10
|
private _max_drawdown;
|
|
11
11
|
private _max_runup;
|
|
12
|
+
private _max_net_drawdown;
|
|
13
|
+
private _max_net_drawdown_percent;
|
|
12
14
|
private _max_runup_percent;
|
|
13
15
|
private _max_drawdown_percent;
|
|
14
16
|
private _variables;
|
|
@@ -106,6 +108,8 @@ export declare class Strategy {
|
|
|
106
108
|
max_runup_percent: number;
|
|
107
109
|
max_drawdown: number;
|
|
108
110
|
max_runup: number;
|
|
111
|
+
max_net_drawdown: number;
|
|
112
|
+
max_net_drawdown_percent: number;
|
|
109
113
|
max_contracts_held_long: number;
|
|
110
114
|
max_contracts_held_short: number;
|
|
111
115
|
max_contracts_held_all: number;
|
|
@@ -9,6 +9,8 @@ export declare class Strategy {
|
|
|
9
9
|
private _max_contracts_held_short;
|
|
10
10
|
private _max_drawdown;
|
|
11
11
|
private _max_runup;
|
|
12
|
+
private _max_net_drawdown;
|
|
13
|
+
private _max_net_drawdown_percent;
|
|
12
14
|
private _max_runup_percent;
|
|
13
15
|
private _max_drawdown_percent;
|
|
14
16
|
private _variables;
|
|
@@ -110,6 +112,8 @@ export declare class Strategy {
|
|
|
110
112
|
max_runup_percent: number;
|
|
111
113
|
max_drawdown: number;
|
|
112
114
|
max_runup: number;
|
|
115
|
+
max_net_drawdown: number;
|
|
116
|
+
max_net_drawdown_percent: number;
|
|
113
117
|
max_contracts_held_long: number;
|
|
114
118
|
max_contracts_held_short: number;
|
|
115
119
|
max_contracts_held_all: number;
|
|
@@ -15057,7 +15057,7 @@ function Kn(i, r, t) {
|
|
|
15057
15057
|
function xy() {
|
|
15058
15058
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
15059
15059
|
}
|
|
15060
|
-
const vd = new Worker(new URL("" + new URL("assets/scriptsRunWorker-
|
|
15060
|
+
const vd = new Worker(new URL("" + new URL("assets/scriptsRunWorker-BLnTwb2Y.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run MineScript Server" });
|
|
15061
15061
|
vd.onerror = (i) => {
|
|
15062
15062
|
console.error(i);
|
|
15063
15063
|
};
|
|
@@ -87,7 +87,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
87
87
|
* @license
|
|
88
88
|
* Copyright 2019 Google LLC
|
|
89
89
|
* SPDX-License-Identifier: Apache-2.0
|
|
90
|
-
*/const tp=Symbol("Comlink.proxy"),Bf=Symbol("Comlink.endpoint"),Nf=Symbol("Comlink.releaseProxy"),Qi=Symbol("Comlink.finalizer"),tn=Symbol("Comlink.thrown"),sp=a=>typeof a=="object"&&a!==null||typeof a=="function",Sf={canHandle:a=>sp(a)&&a[tp],serialize(a){const{port1:s,port2:t}=new MessageChannel;return ap(a,s),[t,[t]]},deserialize(a){return a.start(),Ji(a)}},Ff={canHandle:a=>sp(a)&&tn in a,serialize({value:a}){let s;return a instanceof Error?s={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:s={isError:!1,value:a},[s,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},rp=new Map([["proxy",Sf],["throw",Ff]]);function Lf(a,s){for(const t of a)if(s===t||t==="*"||t instanceof RegExp&&t.test(s))return!0;return!1}function ap(a,s=globalThis,t=["*"]){s.addEventListener("message",function n(i){if(!i||!i.data)return;if(!Lf(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:l,type:c,path:p}=Object.assign({path:[]},i.data),u=(i.data.argumentList||[]).map(cr);let d;try{const y=p.slice(0,-1).reduce((_,h)=>_[h],a),g=p.reduce((_,h)=>_[h],a);switch(c){case"GET":d=g;break;case"SET":y[p.slice(-1)[0]]=cr(i.data.value),d=!0;break;case"APPLY":d=g.apply(y,u);break;case"CONSTRUCT":{const _=new g(...u);d=to(_)}break;case"ENDPOINT":{const{port1:_,port2:h}=new MessageChannel;ap(a,h),d=Kf(_,[_])}break;case"RELEASE":d=void 0;break;default:return}}catch(y){d={value:y,[tn]:0}}Promise.resolve(d).catch(y=>({value:y,[tn]:0})).then(y=>{const[g,_]=nn(y);s.postMessage(Object.assign(Object.assign({},g),{id:l}),_),c==="RELEASE"&&(s.removeEventListener("message",n),np(s),Qi in a&&typeof a[Qi]=="function"&&a[Qi]())}).catch(y=>{const[g,_]=nn({value:new TypeError("Unserializable return value"),[tn]:0});s.postMessage(Object.assign(Object.assign({},g),{id:l}),_)})}),s.start&&s.start()}function Mf(a){return a.constructor.name==="MessagePort"}function np(a){Mf(a)&&a.close()}function Ji(a,s){return eo(a,[],s)}function sn(a){if(a)throw new Error("Proxy has been released and is not useable")}function ip(a){return Nr(a,{type:"RELEASE"}).then(()=>{np(a)})}const rn=new WeakMap,an="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const s=(rn.get(a)||0)-1;rn.set(a,s),s===0&&ip(a)});function Pf(a,s){const t=(rn.get(s)||0)+1;rn.set(s,t),an&&an.register(a,s,a)}function Of(a){an&&an.unregister(a)}function eo(a,s=[],t=function(){}){let n=!1;const i=new Proxy(t,{get(l,c){if(sn(n),c===Nf)return()=>{Of(i),ip(a),n=!0};if(c==="then"){if(s.length===0)return{then:()=>i};const p=Nr(a,{type:"GET",path:s.map(u=>u.toString())}).then(cr);return p.then.bind(p)}return eo(a,[...s,c])},set(l,c,p){sn(n);const[u,d]=nn(p);return Nr(a,{type:"SET",path:[...s,c].map(y=>y.toString()),value:u},d).then(cr)},apply(l,c,p){sn(n);const u=s[s.length-1];if(u===Bf)return Nr(a,{type:"ENDPOINT"}).then(cr);if(u==="bind")return eo(a,s.slice(0,-1));const[d,y]=op(p);return Nr(a,{type:"APPLY",path:s.map(g=>g.toString()),argumentList:d},y).then(cr)},construct(l,c){sn(n);const[p,u]=op(c);return Nr(a,{type:"CONSTRUCT",path:s.map(d=>d.toString()),argumentList:p},u).then(cr)}});return Pf(i,a),i}function Rf(a){return Array.prototype.concat.apply([],a)}function op(a){const s=a.map(nn);return[s.map(t=>t[0]),Rf(s.map(t=>t[1]))]}const lp=new WeakMap;function Kf(a,s){return lp.set(a,s),a}function to(a){return Object.assign(a,{[tp]:!0})}function nn(a){for(const[s,t]of rp)if(t.canHandle(a)){const[n,i]=t.serialize(a);return[{type:"HANDLER",name:s,value:n},i]}return[{type:"RAW",value:a},lp.get(a)||[]]}function cr(a){switch(a.type){case"HANDLER":return rp.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Nr(a,s,t){return new Promise(n=>{const i=Uf();a.addEventListener("message",function l(c){!c.data||!c.data.id||c.data.id!==i||(a.removeEventListener("message",l),n(c.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:i},s),t)})}function Uf(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const cp=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-CdLcsxed.js").href:new URL("assets/scriptsRunWorker-CdLcsxed.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:Sa&&Sa.src||new URL("trading-vue-editor.umd.packages.mjs",document.baseURI).href),{type:"module",name:"Run MineScript Server"});cp.onerror=a=>{console.error(a)};async function pp(a){return await Qa.setInlayHints(a)}const dp=Ji(cp),mp=Ji(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-DLW4EDz8.js").href:new URL("assets/parserTccWorker-DLW4EDz8.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:Sa&&Sa.src||new URL("trading-vue-editor.umd.packages.mjs",document.baseURI).href),{type:"module",name:"Parser MineScript Server"}));async function up(a,s=!1,t=gs){const n=a.match(/\s*\/\/\s*@version\s*=\s*([0-9])/)?.[1];n&&(t=parseInt(n),t=t<3?3:t>6?6:t);const i=await Ks(t);if(!i)return;const{functions:l,types:c,constants:p,variables:u,methods:d}=i.KEY_MAP_LIST;return await mp.parseTcc(a,s,to(pp),{functions:Object.fromEntries(l),methods:Object.fromEntries(d),types:Object.fromEntries(c),constants:Object.fromEntries(p),variables:Object.fromEntries(u)},t)}async function Hf(a,s){const t=a.match(/\s*\/\/\s*@version\s*=\s*([0-9])/)?.[1];let n=6;t&&(n=parseInt(t),n=n<5?5:n>6?6:n);const i=await Ks(n);if(!i)return;const{functions:l,types:c,constants:p,variables:u,methods:d}=i.KEY_MAP_LIST;return await mp.parseLibraryCode(a,s,to(pp),{functions:Object.fromEntries(l),methods:Object.fromEntries(d),types:Object.fromEntries(c),constants:Object.fromEntries(p),variables:Object.fromEntries(u)},n)}async function $f(a,s,t=!0,n=gs){return await dp.runScript(a,s,t,n)}async function jf(a){return await dp.removeScript(a)}function Gf(a){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-rBPieP89.js").href:new URL("assets/editor.worker-rBPieP89.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{type:"module",name:a?.name})}const{slice:Wf,forEach:Xf}=[];function Vf(a){return Xf.call(Wf.call(arguments,1),s=>{if(s)for(const t in s)a[t]===void 0&&(a[t]=s[t])}),a}const yp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Yf=(a,s,t)=>{const n=t||{};n.path=n.path||"/";const i=encodeURIComponent(s);let l=`${a}=${i}`;if(n.maxAge>0){const c=n.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");l+=`; Max-Age=${Math.floor(c)}`}if(n.domain){if(!yp.test(n.domain))throw new TypeError("option domain is invalid");l+=`; Domain=${n.domain}`}if(n.path){if(!yp.test(n.path))throw new TypeError("option path is invalid");l+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");l+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(l+="; HttpOnly"),n.secure&&(l+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"strict":l+="; SameSite=Strict";break;case"none":l+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return l},_p={create(a,s,t,n){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};t&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+t*60*1e3)),n&&(i.domain=n),document.cookie=Yf(a,encodeURIComponent(s),i)},read(a){const s=`${a}=`,t=document.cookie.split(";");for(let n=0;n<t.length;n++){let i=t[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(s)===0)return i.substring(s.length,i.length)}return null},remove(a){this.create(a,"",-1)}};var Zf={name:"cookie",lookup(a){let{lookupCookie:s}=a;if(s&&typeof document<"u")return _p.read(s)||void 0},cacheUserLanguage(a,s){let{lookupCookie:t,cookieMinutes:n,cookieDomain:i,cookieOptions:l}=s;t&&typeof document<"u"&&_p.create(t,a,n,i,l)}},Qf={name:"querystring",lookup(a){let{lookupQuerystring:s}=a,t;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));const l=n.substring(1).split("&");for(let c=0;c<l.length;c++){const p=l[c].indexOf("=");p>0&&l[c].substring(0,p)===s&&(t=l[c].substring(p+1))}}return t}};let ya=null;const fp=()=>{if(ya!==null)return ya;try{ya=window!=="undefined"&&window.localStorage!==null;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{ya=!1}return ya};var Jf={name:"localStorage",lookup(a){let{lookupLocalStorage:s}=a;if(s&&fp())return window.localStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupLocalStorage:t}=s;t&&fp()&&window.localStorage.setItem(t,a)}};let _a=null;const gp=()=>{if(_a!==null)return _a;try{_a=window!=="undefined"&&window.sessionStorage!==null;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{_a=!1}return _a};var eg={name:"sessionStorage",lookup(a){let{lookupSessionStorage:s}=a;if(s&&gp())return window.sessionStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupSessionStorage:t}=s;t&&gp()&&window.sessionStorage.setItem(t,a)}},tg={name:"navigator",lookup(a){const s=[];if(typeof navigator<"u"){const{languages:t,userLanguage:n,language:i}=navigator;if(t)for(let l=0;l<t.length;l++)s.push(t[l]);n&&s.push(n),i&&s.push(i)}return s.length>0?s:void 0}},sg={name:"htmlTag",lookup(a){let{htmlTag:s}=a,t;const n=s||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(t=n.getAttribute("lang")),t}},rg={name:"path",lookup(a){let{lookupFromPathIndex:s}=a;if(typeof window>"u")return;const t=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof s=="number"?s:0]?.replace("/",""):void 0}},ag={name:"subdomain",lookup(a){let{lookupFromSubdomainIndex:s}=a;const t=typeof s=="number"?s+1:1,n=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};function ng(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a}}class bp{constructor(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(s,t)}init(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=s||{languageUtils:{}},this.options=Vf(t,this.options||{},ng()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Zf),this.addDetector(Qf),this.addDetector(Jf),this.addDetector(eg),this.addDetector(tg),this.addDetector(sg),this.addDetector(rg),this.addDetector(ag)}addDetector(s){return this.detectors[s.name]=s,this}detect(s){s||(s=this.options.order);let t=[];return s.forEach(n=>{if(this.detectors[n]){let i=this.detectors[n].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(t=t.concat(i))}}),t=t.map(n=>this.options.convertDetectedLanguage(n)),this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(s,t){t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(s)>-1||t.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(s,this.options)}))}}bp.type="languageDetector";const ig=(...a)=>{console?.warn&&(pr(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),console.warn(...a))},xp={},so=(...a)=>{pr(a[0])&&xp[a[0]]||(pr(a[0])&&(xp[a[0]]=new Date),ig(...a))},hp=(a,s)=>()=>{if(a.isInitialized)s();else{const t=()=>{setTimeout(()=>{a.off("initialized",t)},0),s()};a.on("initialized",t)}},ro=(a,s,t)=>{a.loadNamespaces(s,hp(a,t))},wp=(a,s,t,n)=>{if(pr(t)&&(t=[t]),a.options.preload&&a.options.preload.indexOf(s)>-1)return ro(a,t,n);t.forEach(i=>{a.options.ns.indexOf(i)<0&&a.options.ns.push(i)}),a.loadLanguages(s,hp(a,n))},og=(a,s,t={})=>!s.languages||!s.languages.length?(so("i18n.languages were undefined or empty",s.languages),!0):s.hasLoadedNamespace(a,{lng:t.lng,precheck:(n,i)=>{if(t.bindI18n?.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!i(n.isLanguageChangingTo,a))return!1}}),pr=a=>typeof a=="string",lg=a=>typeof a=="object"&&a!==null,cg=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,pg={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},dg=a=>pg[a];let ao={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:a=>a.replace(cg,dg)};const mg=(a={})=>{ao={...ao,...a}},ug=()=>ao;let vp;const yg=a=>{vp=a},_g=()=>vp,fg={type:"3rdParty",init(a){mg(a.options.react),yg(a)}},gg=U.createContext();class bg{constructor(){this.usedNamespaces={}}addUsedNamespaces(s){s.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const xg=(a,s)=>{const t=U.useRef();return U.useEffect(()=>{t.current=s?t.current:a},[a,s]),t.current},Tp=(a,s,t,n)=>a.getFixedT(s,t,n),hg=(a,s,t,n)=>U.useCallback(Tp(a,s,t,n),[a,s,t,n]),Sr=(a,s={})=>{const{i18n:t}=s,{i18n:n,defaultNS:i}=U.useContext(gg)||{},l=t||n||_g();if(l&&!l.reportNamespaces&&(l.reportNamespaces=new bg),!l){so("You will need to pass in an i18next instance by using initReactI18next");const T=(q,A)=>pr(A)?A:lg(A)&&pr(A.defaultValue)?A.defaultValue:Array.isArray(q)?q[q.length-1]:q,E=[T,{},!1];return E.t=T,E.i18n={},E.ready=!1,E}l.options.react?.wait&&so("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const c={...ug(),...l.options.react,...s},{useSuspense:p,keyPrefix:u}=c;let d=a||i||l.options?.defaultNS;d=pr(d)?[d]:d||["translation"],l.reportNamespaces.addUsedNamespaces?.(d);const y=(l.isInitialized||l.initializedStoreOnce)&&d.every(T=>og(T,l,c)),g=hg(l,s.lng||null,c.nsMode==="fallback"?d:d[0],u),_=()=>g,h=()=>Tp(l,s.lng||null,c.nsMode==="fallback"?d:d[0],u),[w,I]=U.useState(_);let k=d.join();s.lng&&(k=`${s.lng}${k}`);const z=xg(k),b=U.useRef(!0);U.useEffect(()=>{const{bindI18n:T,bindI18nStore:E}=c;b.current=!0,!y&&!p&&(s.lng?wp(l,s.lng,d,()=>{b.current&&I(h)}):ro(l,d,()=>{b.current&&I(h)})),y&&z&&z!==k&&b.current&&I(h);const q=()=>{b.current&&I(h)};return T&&l?.on(T,q),E&&l?.store.on(E,q),()=>{b.current=!1,l&&T?.split(" ").forEach(A=>l.off(A,q)),E&&l&&E.split(" ").forEach(A=>l.store.off(A,q))}},[l,k]),U.useEffect(()=>{b.current&&y&&I(_)},[l,u,y]);const D=[w,l,y];if(D.t=w,D.i18n=l,D.ready=y,y||!y&&!p)return D;throw new Promise(T=>{s.lng?wp(l,s.lng,d,()=>T()):ro(l,d,()=>T())})},wg={type:"type",syntax:"syntax",overloads:"overloads",arguments:"arguments",fields:"fields",example:"example",returns:"returns",remarks:"remarks","see also":"see also","Copy code":"Copy code","Copy link":"Copy link",Copied:"Copied","Link copied":"Link copied",variables:"Variables",constants:"Constants",functions:"Functions",keywords:"Keywords",types:"Types",operators:"Operators",annotations:"Annotations",search:"Search","Mine Script® v1 Reference Manual":"Mine Script® v{{version}} Reference Manual","This script is read-only. It cannot be edited.":"This script is read-only. It cannot be edited.","save script":"Save script","open script":"Open script","find/replace":"Find/Replace","toggle console":"Toggle console","open editor in new tab":"Open editor in new tab","open editor in new window":"Open editor in new window",keyword:"keyword","built-in function":"built-in function","built-in variable":"built-in variable","built-in method":"built-in method","built-in type":"built-in type",annotation:"annotation","built-in constant":"built-in constant",namespace:"namespace","user-defined variable":"user-defined variable","user-defined type":"user-defined type",field:"field",enum:"enum","user-defined method":"user-defined method","user-defined function":"user-defined function",parameter:"parameter","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Mine functions, variables, and methods.","to trigger parameters hint":"to trigger parameters hint",library:"library","enum member":"enum member",Returns:"Returns",Syntax:"Syntax",Remarks:"Remarks",Fields:"Fields",Description:"Description",Example:"Example","Enum members":"Enum members",statement:"statement",loop:"loop","`click` on keyword for more help":"`click` on keyword for more help","new indicator":"New Indicator","new strategy":"New Strategy"},vg={type:"类型",syntax:"语法",overloads:"重载",arguments:"参数",fields:"字段",example:"例子",returns:"返回值",remarks:"备注","see also":"另见","Copy code":"复制代码","Copy link":"复制链接",Copied:"已复制","Link copied":"链接已复制",variables:"内置变量",constants:"常量",functions:"函数",keywords:"关键词",types:"类型",operators:"运算符",annotations:"注释",search:"搜索","Mine Script® v1 Reference Manual":"Mine Script™ v{{version}} 参考手册","This script is read-only. It cannot be edited.":"该脚本是只读的。它无法被编辑。","save script":"保存脚本","open script":"打开脚本","find/replace":"寻找/替换","toggle console":"切换控制台","open editor in new tab":"在新标签页中打开","open editor in new window":"在新窗口中打开",keyword:"关键词","built-in function":"内置函数","built-in variable":"内置变量","built-in method":"内置方法","built-in type":"内置类型",annotation:"注释","built-in constant":"内置常量",namespace:"命名空间","user-defined variable":"用户自定义变量","user-defined type":"用户自定义类型",field:"字段",enum:"枚举","user-defined method":"用户自定义方法","user-defined function":"用户自定义函数",parameter:"参数","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"命名空间是不可变的术语,充当标识符组的前缀。在命名Mine函数、变量和方法时,点和另一个术语始终遵循命名空间。","to trigger parameters hint":"触发参数提示",library:"脚本库","enum member":"枚举成员",Returns:"返回值",Syntax:"语法",Remarks:"备注",Fields:"字段",Description:"描述",Example:"例子","Enum members":"枚举成员",statement:"声明",loop:"循环","`click` on keyword for more help":"“点击”关键词以获得更多帮助","new indicator":"新建指标","new strategy":"新建策略"};He.use(bp).use(fg).init({debug:!1,fallbackLng:"zh",interpolation:{escapeValue:!1},resources:{en:{translation:wg},zh:{translation:vg}}}),self.MonacoEnvironment={getWorker(){return new Gf({name:"Editor Worker"})}},ei.config({paths:{vs:"https://www.tradingvue.com/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const Tg=(a,s)=>{const{height:t,width:n,theme:i,options:l,hasDiff:c,readOnly:p,defaultValue:u,language:d,onChange:y,onLinkOpen:g,onCursorPositionChange:_,onActionTrigger:h,onEditorDidMount:w,onVersionChange:I}=a,{t:k,i18n:z}=Sr(),b=U.useRef(null),D=U.useRef(null),T=U.useRef(!1),E=U.useRef(!1);U.useImperativeHandle(s,()=>({setOriginalScript(L){b.current?.setOriginalScript(L)},setScript(L){b.current?.setValue(L)},gotoLine(){b.current?.gotoLine()},getEditorLayout(){return b.current?.getEditorLayout()},setPosition(L,j){b.current?.setPosition({column:L,lineNumber:j})},setModelMarkers(L){E.current=!0,b.current?.setModelMarkers(L),setTimeout(()=>{E.current=!1},2e3)},focus(){b.current?.focus()}})),U.useEffect(()=>{c?b.current?.addDiffDecorations():b.current?.removeDiffDecorations()},[c]),U.useEffect(()=>{i&&je.editor.setTheme(i)},[i]),U.useEffect(()=>{d&&z.changeLanguage(d)},[d]),U.useEffect(()=>{b.current?.updateActionTrigger(h)},[h]),U.useEffect(()=>{g&&b.current?.addLinkOpenFunc(g)},[g]);function q(L,j){Qa.setEditor(L,j),b.current=new zf(L,j,h),g&&b.current?.addLinkOpenFunc(g),c&&b.current?.addDiffDecorations(),u_(L),requestAnimationFrame(B);const O=L.getValue();b.current.onChangeCursorPosition(_),y&&y(O),!p&&A(O),w&&w()}const A=U.useCallback(async L=>{const j=b.current?.getVersion();I&&I(j||gs),T.current=!1;const{errors:O,functions:ne,methods:Q,types:le,variables:me,overloadsFuncs:Y,imports:ce,enums:ue}=await up(L,!1,j),K=new Map(Object.entries(ne)),ee=new Map(Object.entries(Q)),re=new Map(Object.entries(le)),te=new Map(Object.entries(me)),Ie=new Map(Object.entries(ce)),we=new Map(Object.entries(ue));Us.setUserDefined({functions:K,methods:ee,types:re,variables:te,imports:Ie,enums:we},Y),ns.setUserDefind(K,re,te,ee,we);const $e=O.map(fe=>({...fe,severity:fe.type||je.MarkerSeverity.Error}));p||!T.current&&!E.current&&$e.length&&b.current?.setModelMarkers($e)},[p]),M=U.useMemo(()=>g_.debounce(A,1500),[A]);function H(L){if(p){A(L||"");return}T.current=!0,Qa.clearInlayHints(),b.current?.setModelMarkers([]),L!==void 0&&(y&&y(L),M(L))}const B=U.useCallback(()=>{const L=D.current?.getBoundingClientRect();b.current?.setEditorLayout(L?.height||0,L?.width)},[]);return U.useEffect(()=>{const L=()=>{window.requestAnimationFrame(B)},j=new ResizeObserver(L);return D.current&&j.observe(D.current),()=>{D.current&&j.unobserve(D.current),j.disconnect(),b.current?.dispose()}},[]),F.jsx("div",{ref:D,children:F.jsx(Ny,{height:t,width:n||"100%",defaultLanguage:tt,defaultValue:u||`//@version=6
|
|
90
|
+
*/const tp=Symbol("Comlink.proxy"),Bf=Symbol("Comlink.endpoint"),Nf=Symbol("Comlink.releaseProxy"),Qi=Symbol("Comlink.finalizer"),tn=Symbol("Comlink.thrown"),sp=a=>typeof a=="object"&&a!==null||typeof a=="function",Sf={canHandle:a=>sp(a)&&a[tp],serialize(a){const{port1:s,port2:t}=new MessageChannel;return ap(a,s),[t,[t]]},deserialize(a){return a.start(),Ji(a)}},Ff={canHandle:a=>sp(a)&&tn in a,serialize({value:a}){let s;return a instanceof Error?s={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:s={isError:!1,value:a},[s,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},rp=new Map([["proxy",Sf],["throw",Ff]]);function Lf(a,s){for(const t of a)if(s===t||t==="*"||t instanceof RegExp&&t.test(s))return!0;return!1}function ap(a,s=globalThis,t=["*"]){s.addEventListener("message",function n(i){if(!i||!i.data)return;if(!Lf(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:l,type:c,path:p}=Object.assign({path:[]},i.data),u=(i.data.argumentList||[]).map(cr);let d;try{const y=p.slice(0,-1).reduce((_,h)=>_[h],a),g=p.reduce((_,h)=>_[h],a);switch(c){case"GET":d=g;break;case"SET":y[p.slice(-1)[0]]=cr(i.data.value),d=!0;break;case"APPLY":d=g.apply(y,u);break;case"CONSTRUCT":{const _=new g(...u);d=to(_)}break;case"ENDPOINT":{const{port1:_,port2:h}=new MessageChannel;ap(a,h),d=Kf(_,[_])}break;case"RELEASE":d=void 0;break;default:return}}catch(y){d={value:y,[tn]:0}}Promise.resolve(d).catch(y=>({value:y,[tn]:0})).then(y=>{const[g,_]=nn(y);s.postMessage(Object.assign(Object.assign({},g),{id:l}),_),c==="RELEASE"&&(s.removeEventListener("message",n),np(s),Qi in a&&typeof a[Qi]=="function"&&a[Qi]())}).catch(y=>{const[g,_]=nn({value:new TypeError("Unserializable return value"),[tn]:0});s.postMessage(Object.assign(Object.assign({},g),{id:l}),_)})}),s.start&&s.start()}function Mf(a){return a.constructor.name==="MessagePort"}function np(a){Mf(a)&&a.close()}function Ji(a,s){return eo(a,[],s)}function sn(a){if(a)throw new Error("Proxy has been released and is not useable")}function ip(a){return Nr(a,{type:"RELEASE"}).then(()=>{np(a)})}const rn=new WeakMap,an="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const s=(rn.get(a)||0)-1;rn.set(a,s),s===0&&ip(a)});function Pf(a,s){const t=(rn.get(s)||0)+1;rn.set(s,t),an&&an.register(a,s,a)}function Of(a){an&&an.unregister(a)}function eo(a,s=[],t=function(){}){let n=!1;const i=new Proxy(t,{get(l,c){if(sn(n),c===Nf)return()=>{Of(i),ip(a),n=!0};if(c==="then"){if(s.length===0)return{then:()=>i};const p=Nr(a,{type:"GET",path:s.map(u=>u.toString())}).then(cr);return p.then.bind(p)}return eo(a,[...s,c])},set(l,c,p){sn(n);const[u,d]=nn(p);return Nr(a,{type:"SET",path:[...s,c].map(y=>y.toString()),value:u},d).then(cr)},apply(l,c,p){sn(n);const u=s[s.length-1];if(u===Bf)return Nr(a,{type:"ENDPOINT"}).then(cr);if(u==="bind")return eo(a,s.slice(0,-1));const[d,y]=op(p);return Nr(a,{type:"APPLY",path:s.map(g=>g.toString()),argumentList:d},y).then(cr)},construct(l,c){sn(n);const[p,u]=op(c);return Nr(a,{type:"CONSTRUCT",path:s.map(d=>d.toString()),argumentList:p},u).then(cr)}});return Pf(i,a),i}function Rf(a){return Array.prototype.concat.apply([],a)}function op(a){const s=a.map(nn);return[s.map(t=>t[0]),Rf(s.map(t=>t[1]))]}const lp=new WeakMap;function Kf(a,s){return lp.set(a,s),a}function to(a){return Object.assign(a,{[tp]:!0})}function nn(a){for(const[s,t]of rp)if(t.canHandle(a)){const[n,i]=t.serialize(a);return[{type:"HANDLER",name:s,value:n},i]}return[{type:"RAW",value:a},lp.get(a)||[]]}function cr(a){switch(a.type){case"HANDLER":return rp.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Nr(a,s,t){return new Promise(n=>{const i=Uf();a.addEventListener("message",function l(c){!c.data||!c.data.id||c.data.id!==i||(a.removeEventListener("message",l),n(c.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:i},s),t)})}function Uf(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const cp=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-BLnTwb2Y.js").href:new URL("assets/scriptsRunWorker-BLnTwb2Y.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:Sa&&Sa.src||new URL("trading-vue-editor.umd.packages.mjs",document.baseURI).href),{type:"module",name:"Run MineScript Server"});cp.onerror=a=>{console.error(a)};async function pp(a){return await Qa.setInlayHints(a)}const dp=Ji(cp),mp=Ji(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-DLW4EDz8.js").href:new URL("assets/parserTccWorker-DLW4EDz8.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:Sa&&Sa.src||new URL("trading-vue-editor.umd.packages.mjs",document.baseURI).href),{type:"module",name:"Parser MineScript Server"}));async function up(a,s=!1,t=gs){const n=a.match(/\s*\/\/\s*@version\s*=\s*([0-9])/)?.[1];n&&(t=parseInt(n),t=t<3?3:t>6?6:t);const i=await Ks(t);if(!i)return;const{functions:l,types:c,constants:p,variables:u,methods:d}=i.KEY_MAP_LIST;return await mp.parseTcc(a,s,to(pp),{functions:Object.fromEntries(l),methods:Object.fromEntries(d),types:Object.fromEntries(c),constants:Object.fromEntries(p),variables:Object.fromEntries(u)},t)}async function Hf(a,s){const t=a.match(/\s*\/\/\s*@version\s*=\s*([0-9])/)?.[1];let n=6;t&&(n=parseInt(t),n=n<5?5:n>6?6:n);const i=await Ks(n);if(!i)return;const{functions:l,types:c,constants:p,variables:u,methods:d}=i.KEY_MAP_LIST;return await mp.parseLibraryCode(a,s,to(pp),{functions:Object.fromEntries(l),methods:Object.fromEntries(d),types:Object.fromEntries(c),constants:Object.fromEntries(p),variables:Object.fromEntries(u)},n)}async function $f(a,s,t=!0,n=gs){return await dp.runScript(a,s,t,n)}async function jf(a){return await dp.removeScript(a)}function Gf(a){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-rBPieP89.js").href:new URL("assets/editor.worker-rBPieP89.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{type:"module",name:a?.name})}const{slice:Wf,forEach:Xf}=[];function Vf(a){return Xf.call(Wf.call(arguments,1),s=>{if(s)for(const t in s)a[t]===void 0&&(a[t]=s[t])}),a}const yp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Yf=(a,s,t)=>{const n=t||{};n.path=n.path||"/";const i=encodeURIComponent(s);let l=`${a}=${i}`;if(n.maxAge>0){const c=n.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");l+=`; Max-Age=${Math.floor(c)}`}if(n.domain){if(!yp.test(n.domain))throw new TypeError("option domain is invalid");l+=`; Domain=${n.domain}`}if(n.path){if(!yp.test(n.path))throw new TypeError("option path is invalid");l+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");l+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(l+="; HttpOnly"),n.secure&&(l+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"strict":l+="; SameSite=Strict";break;case"none":l+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return l},_p={create(a,s,t,n){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};t&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+t*60*1e3)),n&&(i.domain=n),document.cookie=Yf(a,encodeURIComponent(s),i)},read(a){const s=`${a}=`,t=document.cookie.split(";");for(let n=0;n<t.length;n++){let i=t[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(s)===0)return i.substring(s.length,i.length)}return null},remove(a){this.create(a,"",-1)}};var Zf={name:"cookie",lookup(a){let{lookupCookie:s}=a;if(s&&typeof document<"u")return _p.read(s)||void 0},cacheUserLanguage(a,s){let{lookupCookie:t,cookieMinutes:n,cookieDomain:i,cookieOptions:l}=s;t&&typeof document<"u"&&_p.create(t,a,n,i,l)}},Qf={name:"querystring",lookup(a){let{lookupQuerystring:s}=a,t;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));const l=n.substring(1).split("&");for(let c=0;c<l.length;c++){const p=l[c].indexOf("=");p>0&&l[c].substring(0,p)===s&&(t=l[c].substring(p+1))}}return t}};let ya=null;const fp=()=>{if(ya!==null)return ya;try{ya=window!=="undefined"&&window.localStorage!==null;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{ya=!1}return ya};var Jf={name:"localStorage",lookup(a){let{lookupLocalStorage:s}=a;if(s&&fp())return window.localStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupLocalStorage:t}=s;t&&fp()&&window.localStorage.setItem(t,a)}};let _a=null;const gp=()=>{if(_a!==null)return _a;try{_a=window!=="undefined"&&window.sessionStorage!==null;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{_a=!1}return _a};var eg={name:"sessionStorage",lookup(a){let{lookupSessionStorage:s}=a;if(s&&gp())return window.sessionStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupSessionStorage:t}=s;t&&gp()&&window.sessionStorage.setItem(t,a)}},tg={name:"navigator",lookup(a){const s=[];if(typeof navigator<"u"){const{languages:t,userLanguage:n,language:i}=navigator;if(t)for(let l=0;l<t.length;l++)s.push(t[l]);n&&s.push(n),i&&s.push(i)}return s.length>0?s:void 0}},sg={name:"htmlTag",lookup(a){let{htmlTag:s}=a,t;const n=s||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(t=n.getAttribute("lang")),t}},rg={name:"path",lookup(a){let{lookupFromPathIndex:s}=a;if(typeof window>"u")return;const t=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof s=="number"?s:0]?.replace("/",""):void 0}},ag={name:"subdomain",lookup(a){let{lookupFromSubdomainIndex:s}=a;const t=typeof s=="number"?s+1:1,n=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};function ng(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a}}class bp{constructor(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(s,t)}init(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=s||{languageUtils:{}},this.options=Vf(t,this.options||{},ng()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Zf),this.addDetector(Qf),this.addDetector(Jf),this.addDetector(eg),this.addDetector(tg),this.addDetector(sg),this.addDetector(rg),this.addDetector(ag)}addDetector(s){return this.detectors[s.name]=s,this}detect(s){s||(s=this.options.order);let t=[];return s.forEach(n=>{if(this.detectors[n]){let i=this.detectors[n].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(t=t.concat(i))}}),t=t.map(n=>this.options.convertDetectedLanguage(n)),this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(s,t){t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(s)>-1||t.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(s,this.options)}))}}bp.type="languageDetector";const ig=(...a)=>{console?.warn&&(pr(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),console.warn(...a))},xp={},so=(...a)=>{pr(a[0])&&xp[a[0]]||(pr(a[0])&&(xp[a[0]]=new Date),ig(...a))},hp=(a,s)=>()=>{if(a.isInitialized)s();else{const t=()=>{setTimeout(()=>{a.off("initialized",t)},0),s()};a.on("initialized",t)}},ro=(a,s,t)=>{a.loadNamespaces(s,hp(a,t))},wp=(a,s,t,n)=>{if(pr(t)&&(t=[t]),a.options.preload&&a.options.preload.indexOf(s)>-1)return ro(a,t,n);t.forEach(i=>{a.options.ns.indexOf(i)<0&&a.options.ns.push(i)}),a.loadLanguages(s,hp(a,n))},og=(a,s,t={})=>!s.languages||!s.languages.length?(so("i18n.languages were undefined or empty",s.languages),!0):s.hasLoadedNamespace(a,{lng:t.lng,precheck:(n,i)=>{if(t.bindI18n?.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!i(n.isLanguageChangingTo,a))return!1}}),pr=a=>typeof a=="string",lg=a=>typeof a=="object"&&a!==null,cg=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,pg={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},dg=a=>pg[a];let ao={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:a=>a.replace(cg,dg)};const mg=(a={})=>{ao={...ao,...a}},ug=()=>ao;let vp;const yg=a=>{vp=a},_g=()=>vp,fg={type:"3rdParty",init(a){mg(a.options.react),yg(a)}},gg=U.createContext();class bg{constructor(){this.usedNamespaces={}}addUsedNamespaces(s){s.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const xg=(a,s)=>{const t=U.useRef();return U.useEffect(()=>{t.current=s?t.current:a},[a,s]),t.current},Tp=(a,s,t,n)=>a.getFixedT(s,t,n),hg=(a,s,t,n)=>U.useCallback(Tp(a,s,t,n),[a,s,t,n]),Sr=(a,s={})=>{const{i18n:t}=s,{i18n:n,defaultNS:i}=U.useContext(gg)||{},l=t||n||_g();if(l&&!l.reportNamespaces&&(l.reportNamespaces=new bg),!l){so("You will need to pass in an i18next instance by using initReactI18next");const T=(q,A)=>pr(A)?A:lg(A)&&pr(A.defaultValue)?A.defaultValue:Array.isArray(q)?q[q.length-1]:q,E=[T,{},!1];return E.t=T,E.i18n={},E.ready=!1,E}l.options.react?.wait&&so("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const c={...ug(),...l.options.react,...s},{useSuspense:p,keyPrefix:u}=c;let d=a||i||l.options?.defaultNS;d=pr(d)?[d]:d||["translation"],l.reportNamespaces.addUsedNamespaces?.(d);const y=(l.isInitialized||l.initializedStoreOnce)&&d.every(T=>og(T,l,c)),g=hg(l,s.lng||null,c.nsMode==="fallback"?d:d[0],u),_=()=>g,h=()=>Tp(l,s.lng||null,c.nsMode==="fallback"?d:d[0],u),[w,I]=U.useState(_);let k=d.join();s.lng&&(k=`${s.lng}${k}`);const z=xg(k),b=U.useRef(!0);U.useEffect(()=>{const{bindI18n:T,bindI18nStore:E}=c;b.current=!0,!y&&!p&&(s.lng?wp(l,s.lng,d,()=>{b.current&&I(h)}):ro(l,d,()=>{b.current&&I(h)})),y&&z&&z!==k&&b.current&&I(h);const q=()=>{b.current&&I(h)};return T&&l?.on(T,q),E&&l?.store.on(E,q),()=>{b.current=!1,l&&T?.split(" ").forEach(A=>l.off(A,q)),E&&l&&E.split(" ").forEach(A=>l.store.off(A,q))}},[l,k]),U.useEffect(()=>{b.current&&y&&I(_)},[l,u,y]);const D=[w,l,y];if(D.t=w,D.i18n=l,D.ready=y,y||!y&&!p)return D;throw new Promise(T=>{s.lng?wp(l,s.lng,d,()=>T()):ro(l,d,()=>T())})},wg={type:"type",syntax:"syntax",overloads:"overloads",arguments:"arguments",fields:"fields",example:"example",returns:"returns",remarks:"remarks","see also":"see also","Copy code":"Copy code","Copy link":"Copy link",Copied:"Copied","Link copied":"Link copied",variables:"Variables",constants:"Constants",functions:"Functions",keywords:"Keywords",types:"Types",operators:"Operators",annotations:"Annotations",search:"Search","Mine Script® v1 Reference Manual":"Mine Script® v{{version}} Reference Manual","This script is read-only. It cannot be edited.":"This script is read-only. It cannot be edited.","save script":"Save script","open script":"Open script","find/replace":"Find/Replace","toggle console":"Toggle console","open editor in new tab":"Open editor in new tab","open editor in new window":"Open editor in new window",keyword:"keyword","built-in function":"built-in function","built-in variable":"built-in variable","built-in method":"built-in method","built-in type":"built-in type",annotation:"annotation","built-in constant":"built-in constant",namespace:"namespace","user-defined variable":"user-defined variable","user-defined type":"user-defined type",field:"field",enum:"enum","user-defined method":"user-defined method","user-defined function":"user-defined function",parameter:"parameter","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Mine functions, variables, and methods.","to trigger parameters hint":"to trigger parameters hint",library:"library","enum member":"enum member",Returns:"Returns",Syntax:"Syntax",Remarks:"Remarks",Fields:"Fields",Description:"Description",Example:"Example","Enum members":"Enum members",statement:"statement",loop:"loop","`click` on keyword for more help":"`click` on keyword for more help","new indicator":"New Indicator","new strategy":"New Strategy"},vg={type:"类型",syntax:"语法",overloads:"重载",arguments:"参数",fields:"字段",example:"例子",returns:"返回值",remarks:"备注","see also":"另见","Copy code":"复制代码","Copy link":"复制链接",Copied:"已复制","Link copied":"链接已复制",variables:"内置变量",constants:"常量",functions:"函数",keywords:"关键词",types:"类型",operators:"运算符",annotations:"注释",search:"搜索","Mine Script® v1 Reference Manual":"Mine Script™ v{{version}} 参考手册","This script is read-only. It cannot be edited.":"该脚本是只读的。它无法被编辑。","save script":"保存脚本","open script":"打开脚本","find/replace":"寻找/替换","toggle console":"切换控制台","open editor in new tab":"在新标签页中打开","open editor in new window":"在新窗口中打开",keyword:"关键词","built-in function":"内置函数","built-in variable":"内置变量","built-in method":"内置方法","built-in type":"内置类型",annotation:"注释","built-in constant":"内置常量",namespace:"命名空间","user-defined variable":"用户自定义变量","user-defined type":"用户自定义类型",field:"字段",enum:"枚举","user-defined method":"用户自定义方法","user-defined function":"用户自定义函数",parameter:"参数","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"命名空间是不可变的术语,充当标识符组的前缀。在命名Mine函数、变量和方法时,点和另一个术语始终遵循命名空间。","to trigger parameters hint":"触发参数提示",library:"脚本库","enum member":"枚举成员",Returns:"返回值",Syntax:"语法",Remarks:"备注",Fields:"字段",Description:"描述",Example:"例子","Enum members":"枚举成员",statement:"声明",loop:"循环","`click` on keyword for more help":"“点击”关键词以获得更多帮助","new indicator":"新建指标","new strategy":"新建策略"};He.use(bp).use(fg).init({debug:!1,fallbackLng:"zh",interpolation:{escapeValue:!1},resources:{en:{translation:wg},zh:{translation:vg}}}),self.MonacoEnvironment={getWorker(){return new Gf({name:"Editor Worker"})}},ei.config({paths:{vs:"https://www.tradingvue.com/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const Tg=(a,s)=>{const{height:t,width:n,theme:i,options:l,hasDiff:c,readOnly:p,defaultValue:u,language:d,onChange:y,onLinkOpen:g,onCursorPositionChange:_,onActionTrigger:h,onEditorDidMount:w,onVersionChange:I}=a,{t:k,i18n:z}=Sr(),b=U.useRef(null),D=U.useRef(null),T=U.useRef(!1),E=U.useRef(!1);U.useImperativeHandle(s,()=>({setOriginalScript(L){b.current?.setOriginalScript(L)},setScript(L){b.current?.setValue(L)},gotoLine(){b.current?.gotoLine()},getEditorLayout(){return b.current?.getEditorLayout()},setPosition(L,j){b.current?.setPosition({column:L,lineNumber:j})},setModelMarkers(L){E.current=!0,b.current?.setModelMarkers(L),setTimeout(()=>{E.current=!1},2e3)},focus(){b.current?.focus()}})),U.useEffect(()=>{c?b.current?.addDiffDecorations():b.current?.removeDiffDecorations()},[c]),U.useEffect(()=>{i&&je.editor.setTheme(i)},[i]),U.useEffect(()=>{d&&z.changeLanguage(d)},[d]),U.useEffect(()=>{b.current?.updateActionTrigger(h)},[h]),U.useEffect(()=>{g&&b.current?.addLinkOpenFunc(g)},[g]);function q(L,j){Qa.setEditor(L,j),b.current=new zf(L,j,h),g&&b.current?.addLinkOpenFunc(g),c&&b.current?.addDiffDecorations(),u_(L),requestAnimationFrame(B);const O=L.getValue();b.current.onChangeCursorPosition(_),y&&y(O),!p&&A(O),w&&w()}const A=U.useCallback(async L=>{const j=b.current?.getVersion();I&&I(j||gs),T.current=!1;const{errors:O,functions:ne,methods:Q,types:le,variables:me,overloadsFuncs:Y,imports:ce,enums:ue}=await up(L,!1,j),K=new Map(Object.entries(ne)),ee=new Map(Object.entries(Q)),re=new Map(Object.entries(le)),te=new Map(Object.entries(me)),Ie=new Map(Object.entries(ce)),we=new Map(Object.entries(ue));Us.setUserDefined({functions:K,methods:ee,types:re,variables:te,imports:Ie,enums:we},Y),ns.setUserDefind(K,re,te,ee,we);const $e=O.map(fe=>({...fe,severity:fe.type||je.MarkerSeverity.Error}));p||!T.current&&!E.current&&$e.length&&b.current?.setModelMarkers($e)},[p]),M=U.useMemo(()=>g_.debounce(A,1500),[A]);function H(L){if(p){A(L||"");return}T.current=!0,Qa.clearInlayHints(),b.current?.setModelMarkers([]),L!==void 0&&(y&&y(L),M(L))}const B=U.useCallback(()=>{const L=D.current?.getBoundingClientRect();b.current?.setEditorLayout(L?.height||0,L?.width)},[]);return U.useEffect(()=>{const L=()=>{window.requestAnimationFrame(B)},j=new ResizeObserver(L);return D.current&&j.observe(D.current),()=>{D.current&&j.unobserve(D.current),j.disconnect(),b.current?.dispose()}},[]),F.jsx("div",{ref:D,children:F.jsx(Ny,{height:t,width:n||"100%",defaultLanguage:tt,defaultValue:u||`//@version=6
|
|
91
91
|
indicator("我的脚本")
|
|
92
92
|
plot(close)
|
|
93
93
|
`,theme:i||"vs-dark",className:`tvue-script ${i||"vs-dark"}`,options:{colorDecorators:!0,useShadowDOM:!1,matchOnWordStartOnly:!0,automaticLayout:!1,unicodeHighlight:{allowedCharacters:{" ":!0}},suggest:{filterGraceful:!0},stickyScroll:{enabled:!1},fontSize:13,...p?Fy:{},readOnlyMessage:{value:k("This script is read-only. It cannot be edited.")},...l},onMount:q,onChange:H})})},kg=U.forwardRef(Tg),Dg=a=>{const{theme:s,modified:t,original:n,height:i,width:l,renderSideBySide:c=!0,version:p=gs}=a,u=U.useCallback(async(d,y)=>{y.languages.register({id:tt}),y.editor.defineTheme("vs-dark",oi),y.editor.defineTheme("vs",ii);const g=await ja(p);g&&(y.languages.setMonarchTokensProvider(tt,g.LANGUAGE_MONARCH_TOKENS),y.languages.setLanguageConfiguration(tt,g.CONFIGURATION))},[p]);return F.jsx(qy,{height:i||"90vh",width:l||"100%",theme:s||"vs-dark",options:{readOnly:!0,renderSideBySide:c,scrollBeyondLastLine:!1},language:tt,modified:t,original:n,onMount:u})};Z.VMarkerSeverity=void 0,function(a){a[a.Hint=1]="Hint",a[a.Info=2]="Info",a[a.Warning=4]="Warning",a[a.Error=8]="Error"}(Z.VMarkerSeverity||(Z.VMarkerSeverity={}));var on={},Ig=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var s=document.activeElement,t=[],n=0;n<a.rangeCount;n++)t.push(a.getRangeAt(n));switch(s.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":s.blur();break;default:s=null;break}return a.removeAllRanges(),function(){a.type==="Caret"&&a.removeAllRanges(),a.rangeCount||t.forEach(function(i){a.addRange(i)}),s&&s.focus()}},Ag=Ig,kp={"text/plain":"Text","text/html":"Url",default:"Text"},qg="Copy to clipboard: #{key}, Enter";function Cg(a){var s=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,s)}function Eg(a,s){var t,n,i,l,c,p,u=!1;s||(s={}),t=s.debug||!1;try{i=Ag(),l=document.createRange(),c=document.getSelection(),p=document.createElement("span"),p.textContent=a,p.ariaHidden="true",p.style.all="unset",p.style.position="fixed",p.style.top=0,p.style.clip="rect(0, 0, 0, 0)",p.style.whiteSpace="pre",p.style.webkitUserSelect="text",p.style.MozUserSelect="text",p.style.msUserSelect="text",p.style.userSelect="text",p.addEventListener("copy",function(y){if(y.stopPropagation(),s.format)if(y.preventDefault(),typeof y.clipboardData>"u"){t&&console.warn("unable to use e.clipboardData"),t&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var g=kp[s.format]||kp.default;window.clipboardData.setData(g,a)}else y.clipboardData.clearData(),y.clipboardData.setData(s.format,a);s.onCopy&&(y.preventDefault(),s.onCopy(y.clipboardData))}),document.body.appendChild(p),l.selectNodeContents(p),c.addRange(l);var d=document.execCommand("copy");if(!d)throw new Error("copy command was unsuccessful");u=!0}catch(y){t&&console.error("unable to copy using execCommand: ",y),t&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(s.format||"text",a),s.onCopy&&s.onCopy(window.clipboardData),u=!0}catch(g){t&&console.error("unable to copy using clipboardData: ",g),t&&console.error("falling back to prompt"),n=Cg("message"in s?s.message:qg),window.prompt(n,a)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(l):c.removeAllRanges()),p&&document.body.removeChild(p),i()}return u}var zg=Eg;function no(a){"@babel/helpers - typeof";return no=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},no(a)}Object.defineProperty(on,"__esModule",{value:!0}),on.CopyToClipboard=void 0;var ln=Dp(U),Bg=Dp(zg),Ng=["text","onCopy","options","children"];function Dp(a){return a&&a.__esModule?a:{default:a}}function Ip(a,s){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);s&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(a,i).enumerable})),t.push.apply(t,n)}return t}function Ap(a){for(var s=1;s<arguments.length;s++){var t=arguments[s]!=null?arguments[s]:{};s%2?Ip(Object(t),!0).forEach(function(n){oo(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):Ip(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function Sg(a,s){if(a==null)return{};var t=Fg(a,s),n,i;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(i=0;i<l.length;i++)n=l[i],!(s.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}function Fg(a,s){if(a==null)return{};var t={},n=Object.keys(a),i,l;for(l=0;l<n.length;l++)i=n[l],!(s.indexOf(i)>=0)&&(t[i]=a[i]);return t}function Lg(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}function qp(a,s){for(var t=0;t<s.length;t++){var n=s[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(a,n.key,n)}}function Mg(a,s,t){return s&&qp(a.prototype,s),t&&qp(a,t),Object.defineProperty(a,"prototype",{writable:!1}),a}function Pg(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),s&&io(a,s)}function io(a,s){return io=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},io(a,s)}function Og(a){var s=Kg();return function(){var n=cn(a),i;if(s){var l=cn(this).constructor;i=Reflect.construct(n,arguments,l)}else i=n.apply(this,arguments);return Rg(this,i)}}function Rg(a,s){if(s&&(no(s)==="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cp(a)}function Cp(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function Kg(){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 cn(a){return cn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},cn(a)}function oo(a,s,t){return s in a?Object.defineProperty(a,s,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[s]=t,a}var Ep=function(a){Pg(t,a);var s=Og(t);function t(){var n;Lg(this,t);for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return n=s.call.apply(s,[this].concat(l)),oo(Cp(n),"onClick",function(p){var u=n.props,d=u.text,y=u.onCopy,g=u.children,_=u.options,h=ln.default.Children.only(g),w=(0,Bg.default)(d,_);y&&y(d,w),h&&h.props&&typeof h.props.onClick=="function"&&h.props.onClick(p)}),n}return Mg(t,[{key:"render",value:function(){var i=this.props;i.text,i.onCopy,i.options;var l=i.children,c=Sg(i,Ng),p=ln.default.Children.only(l);return ln.default.cloneElement(p,Ap(Ap({},c),{},{onClick:this.onClick}))}}]),t}(ln.default.PureComponent);on.CopyToClipboard=Ep,oo(Ep,"defaultProps",{onCopy:void 0,options:void 0});var Ug=on,lo=Ug.CopyToClipboard;lo.CopyToClipboard=lo;var Hg=lo;const Fr=wu(Hg);je.languages.register({id:tt}),je.editor.defineTheme("vs-dark",oi),je.editor.defineTheme("vs",ii);const zp=[{label:"版本 v3",version:3},{label:"版本 v4",version:4},{label:"版本 v5",version:5},{label:"版本 v6",version:6}];async function co(a){const s=await ja(a);s&&(je.languages.setMonarchTokensProvider(tt,s.LANGUAGE_MONARCH_TOKENS),je.languages.setLanguageConfiguration(tt,s.CONFIGURATION))}async function Bp(a,s,t){return s&&je.editor.setTheme(s.includes("dark")?"vs-dark":"light"),t&&await co(t),await je.editor.colorize(a,tt,{tabSize:4})}async function po(a,s=0){const t=a[s];if(!t)return;const{name:n,args:i,type:l,desc:c,examples:p,remarks:u,seeAlso:d,syntax:y,detailedDesc:g,fields:_,returns:h}=t,w={name:n,orirginalName:n};if(a.length>1&&(w.overloads=`${a.length} ${He.t("overloads")}`),l&&(w.type=l),i&&(w.name=`${n}()`,w.args=i.map(I=>{const{name:k,desc:z,displayType:b}=I;return{label:`${k} (${b})`,desc:z&&dr(z)}})),c&&(w.desc=c.map(I=>dr(I))),p&&(w.originalExample=p.join(`
|