Files
ai/charting_library/bundles/6204.f5ec067e24c920d7e58f.js

4 lines
12 KiB
JavaScript

"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[6204],{73174:(e,t,i)=>{i.r(t),i.d(t,{getCoordinateXMetaInfo:()=>y,getCoordinateYMetaInfo:()=>b,getCoordinatesPropertiesDefinitions:()=>T,getSelectionCoordinatesPropertyDefinition:()=>x});var o=i(50151),n=i(11542),r=i(45126),l=i(44672),a=i(60265);class s extends a.UndoCommand{constructor({lineToolId:e,chartModel:t,newPositionPoints:i}){super(null),this._pointState=null,this._lineToolId=e,this._model=t,this._newPositionPoints=i}redo(){const e=(0,o.ensureNotNull)(this._model.dataSourceForId(this._lineToolId));this._pointState=[e.normalizedPoints(),e.points()],e.startChanging(),e.moveLineTool(this._newPositionPoints),this._model.updateSource(e),e.updateAllViews((0,l.sourceChangeEvent)(e.id())),e.syncMultichartState(e.endChanging(!0,!1))}undo(){if(this._pointState){const e=(0,o.ensureNotNull)(this._model.dataSourceForId(this._lineToolId));e.startChanging(),e.restorePoints(...this._pointState),this._model.updateSource(e),e.updateAllViews((0,l.sourceChangeEvent)(e.id())),e.syncMultichartState(e.endChanging(!0,!1))}}}var d=i(32097),c=i(64147),p=i(12988),u=i(91682);const h=-5e4,v=15e3,g=new r.TranslatedString("change price Y coordinate",n.t(null,void 0,i(11737))),m=new r.TranslatedString("change bar X coordinate",n.t(null,void 0,i(2066))),f=new r.TranslatedString("move drawings",n.t(null,void 0,i(76261)));function b(e,t,i){return{property:(0,d.convertToDefinitionProperty)(e,t.price,g),info:{typeY:1,stepY:i}}}function y(e,t){return{property:(0,d.convertToDefinitionProperty)(e,t.bar,m),info:{typeX:0,minX:new c.WatchedValue(h),maxX:new c.WatchedValue(v),stepX:new c.WatchedValue(1)}}}function T(e,t,i,o,n,r){const l=y(e,t),a=b(e,t,o);return(0,d.createCoordinatesPropertyDefinition)({x:l.property,y:a.property},{id:(0,u.removeSpaces)(`${r}Coordinates${n}`),title:n,...l.info,...a.info})}const P=/^([+*\-\/]?)((?:\d*)|(?:\d+\.\d*))$/;function w(e,t,i){const n=new p.Property(""),r=(0,d.makeProxyDefinitionProperty)(n.weakReference());return r.setValue=r=>{try{const n=r.match(P);if(!n)return;const[,l,a]=n;if(!a.length)return;const d=i(parseFloat(a));if("/"===l&&(0===d.price||0===d.index))return;t.withMacro(f,(()=>{e.filter((e=>!e.isSourceHidden())).forEach((e=>{const i=e.points();let n;switch(l){case"":{const e=(0,o.ensureDefined)(i[0]);let{index:t=e.index,price:r=e.price}=d;r-=e.price,t-=e.index,n=i.map((e=>({...e,index:e.index+t,price:e.price+r})));break}case"-":case"+":{let{index:e=0,price:t=0}=d;"-"===l&&(e*=-1,t*=-1),n=i.map((i=>({...i,index:i.index+e,price:i.price+t})));break}case"*":{const{index:e=1,price:t=1}=d;n=i.map((i=>({...i,index:i.index*e,price:i.price*t})));break}case"/":{const{index:e=1,price:t=1}=d;n=i.map((i=>({...i,index:i.index/e,price:i.price/t})));break}}t.undoHistory().pushUndoCommand(new s({lineToolId:e.id(),chartModel:t.model(),newPositionPoints:n}))}))}))}finally{n.setValue("",!0)}},r}function x(e,t){const o=w(e,t,(e=>({index:e}))),r=w(e,t,(e=>({price:e})));return(0,d.createSelectionCoordinatesPropertyDefinition)({x:o,y:r},{
id:"SourcesCoordinates",title:n.t(null,void 0,i(44272)),mathOperationsX:"+",mathOperationsY:"+/*",modeX:"integer",modeY:"float"})}},91335:(e,t,i)=>{i.d(t,{createTextStyleDefinition:()=>S});var o=i(11542),n=i(45126),r=i(32097),l=i(91682);const a=new n.TranslatedString("change {toolName} text visibility",o.t(null,void 0,i(56634))),s=new n.TranslatedString("change {toolName} text color",o.t(null,void 0,i(64500))),d=new n.TranslatedString("change {toolName} text font size",o.t(null,void 0,i(21781))),c=new n.TranslatedString("change {toolName} text font bold",o.t(null,void 0,i(24701))),p=new n.TranslatedString("change {toolName} text font italic",o.t(null,void 0,i(42694))),u=new n.TranslatedString("change {toolName} text",o.t(null,void 0,i(66668))),h=new n.TranslatedString("change {toolName} labels alignment vertical",o.t(null,void 0,i(31689))),v=new n.TranslatedString("change {toolName} labels alignment horizontal",o.t(null,void 0,i(88277))),g=new n.TranslatedString("change {toolName} labels direction",o.t(null,void 0,i(61160))),m=new n.TranslatedString("change {toolName} text background visibility",o.t(null,void 0,i(31133))),f=new n.TranslatedString("change {toolName} text background color",o.t(null,void 0,i(22231))),b=new n.TranslatedString("change {toolName} text border visibility",o.t(null,void 0,i(58704))),y=new n.TranslatedString("change {toolName} text border width",o.t(null,void 0,i(35423))),T=new n.TranslatedString("change {toolName} text border color",o.t(null,void 0,i(36666))),P=new n.TranslatedString("change {toolName} text wrap",o.t(null,void 0,i(39587))),w=o.t(null,void 0,i(79468)),x=o.t(null,void 0,i(38408)),_=o.t(null,void 0,i(7560));function S(e,t,i,o){const n={},S={id:`${(0,l.removeSpaces)(i.originalText())}Text`,title:o.customTitles&&o.customTitles.text||""};if(void 0!==t.showText&&(n.checked=(0,r.convertToDefinitionProperty)(e,t.showText,a.format({toolName:i}))),void 0!==t.textColor&&(n.color=(0,r.getColorDefinitionProperty)(e,t.textColor,t.transparency||null,s.format({toolName:i}))),void 0!==t.fontSize&&(n.size=(0,r.convertToDefinitionProperty)(e,t.fontSize,d.format({toolName:i}))),void 0!==t.bold&&(n.bold=(0,r.convertToDefinitionProperty)(e,t.bold,c.format({toolName:i}))),void 0!==t.italic&&(n.italic=(0,r.convertToDefinitionProperty)(e,t.italic,p.format({toolName:i}))),void 0!==t.text&&(n.text=(0,r.convertToDefinitionProperty)(e,t.text,u.format({toolName:i})),S.isEditable=Boolean(o.isEditable),S.isMultiLine=Boolean(o.isMultiLine)),void 0!==t.vertLabelsAlign&&(n.alignmentVertical=(0,r.convertToDefinitionProperty)(e,t.vertLabelsAlign,h.format({toolName:i})),S.alignmentVerticalItems=o.alignmentVerticalItems),void 0!==t.horzLabelsAlign&&(n.alignmentHorizontal=(0,r.convertToDefinitionProperty)(e,t.horzLabelsAlign,v.format({toolName:i})),S.alignmentHorizontalItems=o.alignmentHorizontalItems),void 0!==t.textOrientation&&(n.orientation=(0,r.convertToDefinitionProperty)(e,t.textOrientation,g.format({toolName:i}))),void 0!==t.backgroundVisible&&(n.backgroundVisible=(0,
r.convertToDefinitionProperty)(e,t.backgroundVisible,m.format({toolName:i}))),void 0!==t.backgroundColor){let o=null;void 0!==t.backgroundTransparency&&(o=t.backgroundTransparency),n.backgroundColor=(0,r.getColorDefinitionProperty)(e,t.backgroundColor,o,f.format({toolName:i}))}return void 0===t.backgroundVisible&&void 0===t.backgroundColor||(S.backgroundTitle=o.customTitles&&o.customTitles.backgroundTitle||w),void 0!==t.borderVisible&&(n.borderVisible=(0,r.convertToDefinitionProperty)(e,t.borderVisible,b.format({toolName:i}))),void 0!==t.borderWidth&&(n.borderWidth=(0,r.convertToDefinitionProperty)(e,t.borderWidth,y.format({toolName:i}))),void 0!==t.borderColor&&(n.borderColor=(0,r.getColorDefinitionProperty)(e,t.borderColor,null,T.format({toolName:i}))),void 0===t.borderVisible&&void 0===t.borderColor&&void 0===t.borderWidth||(S.borderTitle=o.customTitles&&o.customTitles.borderTitle||x),void 0!==t.wrap&&(n.wrap=(0,r.convertToDefinitionProperty)(e,t.wrap,P.format({toolName:i})),S.wrapTitle=o.customTitles&&o.customTitles.wrapTitle||_),(0,r.createTextPropertyDefinition)(n,S)}},23720:(e,t,i)=>{i.r(t),i.d(t,{FibTimezoneDefinitionsViewModel:()=>C,availableAlignmentHorizontalItems:()=>D,availableAlignmentVerticalItems:()=>S});var o=i(50151),n=i(11542),r=i(45126),l=i(32097),a=i(18009),s=i(30699),d=i(64147),c=i(91682),p=i(95166);const u=new r.TranslatedString("change {title} level {index} line visibility",n.t(null,void 0,i(51403))),h=new r.TranslatedString("change {title} level {index} line color",n.t(null,void 0,i(664))),v=new r.TranslatedString("change {title} level {index} line width",n.t(null,void 0,i(97870))),g=new r.TranslatedString("change {title} level {index} line style",n.t(null,void 0,i(64707))),m=new r.TranslatedString("change {title} level {index} line coeff",n.t(null,void 0,i(27154))),f=new r.TranslatedString("change {title} all lines color",n.t(null,void 0,i(59577))),b=new r.TranslatedString("change {title} background visibility",n.t(null,void 0,i(30839))),y=new r.TranslatedString("change {title} background transparency",n.t(null,void 0,i(13783))),T=new r.TranslatedString("change {title} labels visibility",n.t(null,void 0,i(93340))),P=new r.TranslatedString("change {title} labels alignment",n.t(null,void 0,i(55612))),w=n.t(null,void 0,i(28683)),x=n.t(null,void 0,i(79468)),_=n.t(null,void 0,i(5119)),S=[{id:s.VerticalAlign.Bottom,value:s.VerticalAlign.Top,title:n.t(null,void 0,i(97118))},{id:s.VerticalAlign.Middle,value:s.VerticalAlign.Middle,title:n.t(null,void 0,i(68833))},{id:s.VerticalAlign.Top,value:s.VerticalAlign.Bottom,title:n.t(null,void 0,i(27567))}],D=[{id:s.HorizontalAlign.Left,value:s.HorizontalAlign.Left,title:n.t(null,void 0,i(11626))},{id:s.HorizontalAlign.Center,value:s.HorizontalAlign.Center,title:n.t(null,void 0,i(24197))},{id:s.HorizontalAlign.Right,value:s.HorizontalAlign.Right,title:n.t(null,void 0,i(50421))}];class C extends a.LineDataSourceDefinitionsViewModel{_stylePropertyDefinitions(){const e=[],t=this._source.properties().childs(),i=this._source.name(),n=(0,
c.removeSpaces)(i),a=new r.TranslatedString(i,this._source.translatedType()),s=this._source.levelsCount();for(let i=1;i<=s;i++){const o=t[`level${i}`].childs(),r=(0,l.createLeveledLinePropertyDefinition)({checked:(0,l.convertToDefinitionProperty)(this._propertyApplier,o.visible,u.format({title:a,index:i})),color:(0,l.getColorDefinitionProperty)(this._propertyApplier,o.color,null,h.format({title:a,index:i})),width:(0,l.convertToDefinitionProperty)(this._propertyApplier,o.linewidth,v.format({title:a,index:i})),style:(0,l.convertToDefinitionProperty)(this._propertyApplier,o.linestyle,g.format({title:a,index:i})),level:(0,l.convertToDefinitionProperty)(this._propertyApplier,o.coeff,m.format({title:a,index:i}))},{id:`${n}LineLevel${i}`});e.push(r)}const C=(0,l.createColorPropertyDefinition)({color:(0,l.getColorDefinitionProperty)(this._propertyApplier,new p.CollectibleColorPropertyUndoWrapper((0,o.ensureNotNull)(this._source.lineColorsProperty()),this._propertyApplier,null),null,f.format({title:a}),!0)},{id:`${n}AllLineColor`,title:w});e.push(C);const A=(0,l.createTransparencyPropertyDefinition)({checked:(0,l.convertToDefinitionProperty)(this._propertyApplier,t.fillBackground,b.format({title:a})),transparency:(0,l.convertToDefinitionProperty)(this._propertyApplier,t.transparency,y.format({title:a}))},{id:`${n}Background`,title:x});e.push(A);const N=(0,l.createTwoOptionsPropertyDefinition)({checked:(0,l.convertToDefinitionProperty)(this._propertyApplier,t.showLabels,T.format({title:a})),option1:(0,l.convertToDefinitionProperty)(this._propertyApplier,t.horzLabelsAlign,P.format({title:a})),option2:(0,l.convertToDefinitionProperty)(this._propertyApplier,t.vertLabelsAlign,P.format({title:a}))},{id:`${n}Labels`,title:_,optionsItems1:new d.WatchedValue(D),optionsItems2:new d.WatchedValue(S)});return e.push(N),{definitions:e}}}},95166:(e,t,i)=>{i.d(t,{CollectibleColorPropertyDirectWrapper:()=>a,CollectibleColorPropertyUndoWrapper:()=>l});var o=i(50151),n=i(12988);class r extends n.Property{constructor(e){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=e}destroy(){this._baseProperty.destroy(),super.destroy()}value(){const e=this._baseProperty.value();return"mixed"===e?"":e}visible(){return this._baseProperty.visible()}setValue(e){this._isProcess=!0,this._baseProperty.setValue(""===e?"mixed":e,void 0,{applyValue:this._applyValue.bind(this)}),this._isProcess=!1,this._listenersMappers.forEach((e=>{e.method.call(e.obj,this,"")}))}subscribe(e,t){const i=i=>{this._isProcess||t.call(e,this,"")},o={obj:e,method:t,callback:i};this._listenersMappers.push(o),this._baseProperty.subscribe(e,i)}unsubscribe(e,t){const i=(0,o.ensureDefined)(this._listenersMappers.find((i=>i.obj===e&&i.method===t))?.callback);this._baseProperty.unsubscribe(e,i)}unsubscribeAll(e){this._baseProperty.unsubscribeAll(e)}}class l extends r{constructor(e,t,i){super(e),this._propertyApplier=t,this._undoText=i}_applyValue(e,t){this._propertyApplier.setProperty(e,t,this._undoText)}}class a extends r{_applyValue(e,t){e.setValue(t)}}}}]);