Files
ai/web/public/charting_library/bundles/2745.73995b6670d622d97310.js

5 lines
13 KiB
JavaScript

"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[2745],{97578:(e,t,n)=>{n.r(t),n.d(t,{getCoordinateXMetaInfo:()=>g,getCoordinateYMetaInfo:()=>P,getCoordinatesPropertiesDefinitions:()=>T,getSelectionCoordinatesPropertyDefinition:()=>C});var i=n(50151),o=n(77914),r=n(11542),l=n(95804),s=n(40472),a=n(72270);class d extends a.UndoCommand{constructor({lineToolId:e,chartModel:t,newPositionPoints:n}){super(null),this._pointState=null,this._lineToolId=e,this._model=t,this._newPositionPoints=n}redo(){const e=(0,i.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,s.sourceChangeEvent)(e.id())),e.syncMultichartState(e.endChanging(!0,!1))}undo(){if(this._pointState){const e=(0,i.ensureNotNull)(this._model.dataSourceForId(this._lineToolId));e.startChanging(),e.restorePoints(...this._pointState),this._model.updateSource(e),e.updateAllViews((0,s.sourceChangeEvent)(e.id())),e.syncMultichartState(e.endChanging(!0,!1))}}}var c=n(95338),p=n(22613),u=n(43337),h=n(91682);const y=-5e4,m=15e3,w=new l.TranslatedString("change price Y coordinate",r.t(null,void 0,n(11737))),f=new l.TranslatedString("change bar X coordinate",r.t(null,void 0,n(2066))),v=new l.TranslatedString("move drawings",r.t(null,void 0,n(76261)));function P(e,t,n){return{property:(0,c.convertToDefinitionProperty)(e,t.price,w),info:{typeY:1,stepY:n}}}function g(e,t){return{property:(0,c.convertToDefinitionProperty)(e,t.bar,null,void 0,(n=>{n!==t.bar.value()&&e.setProperty(t.bar,(0,o.clamp)(n,y,m),f)})),info:{typeX:0,stepX:new p.WatchedValue(1)}}}function T(e,t,n,i,o,r){const l=g(e,t),s=P(e,t,i);return(0,c.createCoordinatesPropertyDefinition)({x:l.property,y:s.property},{id:(0,h.removeSpaces)(`${r}Coordinates${o}`),title:o,...l.info,...s.info})}const b=/^([+*\-\/]?)((?:\d*)|(?:\d+\.\d*))$/;function S(e,t,n){const o=new u.Property(""),r=(0,c.makeProxyDefinitionProperty)(o.weakReference());return r.setValue=r=>{try{const o=r.match(b);if(!o)return;const[,l,s]=o;if(!s.length)return;const a=n(parseFloat(s));if("/"===l&&(0===a.price||0===a.index))return;t.withMacro(v,(()=>{e.filter((e=>!e.isSourceHidden())).forEach((e=>{const n=e.points();let o;switch(l){case"":{const e=(0,i.ensureDefined)(n[0]);let{index:t=e.index,price:r=e.price}=a;r-=e.price,t-=e.index,o=n.map((e=>({...e,index:e.index+t,price:e.price+r})));break}case"-":case"+":{let{index:e=0,price:t=0}=a;"-"===l&&(e*=-1,t*=-1),o=n.map((n=>({...n,index:n.index+e,price:n.price+t})));break}case"*":{const{index:e=1,price:t=1}=a;o=n.map((n=>({...n,index:n.index*e,price:n.price*t})));break}case"/":{const{index:e=1,price:t=1}=a;o=n.map((n=>({...n,index:n.index/e,price:n.price/t})));break}}t.undoHistory().pushUndoCommand(new d({lineToolId:e.id(),chartModel:t.model(),newPositionPoints:o}))}))}))}finally{o.setValue("",!0)}},r}function C(e,t){const i=S(e,t,(e=>({index:e}))),o=S(e,t,(e=>({price:e})));return(0,
c.createSelectionCoordinatesPropertyDefinition)({x:i,y:o},{id:"SourcesCoordinates",title:r.t(null,void 0,n(44272)),mathOperationsX:"+",mathOperationsY:"+/*",modeX:"integer",modeY:"float"})}},73863:(e,t,n)=>{n.r(t),n.d(t,{getIntervalsVisibilitiesPropertiesDefinitions:()=>ae,getSelectionIntervalsVisibilitiesPropertiesDefinition:()=>de});var i=n(11542),o=n(95804),r=n(95338),l=n(22613),s=n(87296),a=n(15574),d=n(65045),c=n(66567);const p=new o.TranslatedString("change {title} visibility on ticks",i.t(null,void 0,n(98596))),u=new o.TranslatedString("change {title} visibility on seconds",i.t(null,void 0,n(41315))),h=new o.TranslatedString("change {title} seconds from",i.t(null,void 0,n(86780))),y=new o.TranslatedString("change {title} seconds to",i.t(null,void 0,n(6573))),m=new o.TranslatedString("change {title} visibility on minutes",i.t(null,void 0,n(78219))),w=new o.TranslatedString("change {title} minutes from",i.t(null,void 0,n(59820))),f=new o.TranslatedString("change {title} minutes to",i.t(null,void 0,n(38011))),v=new o.TranslatedString("change {title} visibility on hours",i.t(null,void 0,n(68715))),P=new o.TranslatedString("change {title} hours from",i.t(null,void 0,n(8306))),g=new o.TranslatedString("change {title} hours to",i.t(null,void 0,n(67233))),T=new o.TranslatedString("change {title} visibility on days",i.t(null,void 0,n(56402))),b=new o.TranslatedString("change {title} days from",i.t(null,void 0,n(91201))),S=new o.TranslatedString("change {title} days to",i.t(null,void 0,n(96135))),C=new o.TranslatedString("change {title} visibility on weeks",i.t(null,void 0,n(71084))),k=new o.TranslatedString("change {title} weeks from",i.t(null,void 0,n(32481))),V=new o.TranslatedString("change {title} weeks to",i.t(null,void 0,n(18678))),W=new o.TranslatedString("change {title} visibility on months",i.t(null,void 0,n(67583))),D=new o.TranslatedString("change {title} months from",i.t(null,void 0,n(99122))),_=new o.TranslatedString("change {title} months to",i.t(null,void 0,n(10518))),x=(new o.TranslatedString("change {title} visibility on ranges",i.t(null,{replace:{ranges:"ranges"}},n(55616))),
i.t(null,void 0,n(24821))),U=i.t(null,void 0,n(65188)),I=i.t(null,void 0,n(42562)),M=i.t(null,void 0,n(56796)),L=i.t(null,void 0,n(72942)),F=i.t(null,void 0,n(835)),A=i.t(null,void 0,n(43154)),R=new o.TranslatedString("ticks",i.t(null,void 0,n(3539))),N=new o.TranslatedString("seconds",i.t(null,void 0,n(751))),E=new o.TranslatedString("seconds from",i.t(null,void 0,n(35801))),X=new o.TranslatedString("seconds to",i.t(null,void 0,n(73419))),Y=new o.TranslatedString("minutes",i.t(null,void 0,n(18726))),H=new o.TranslatedString("minutes from",i.t(null,void 0,n(22476))),j=new o.TranslatedString("minutes to",i.t(null,void 0,n(67649))),$=new o.TranslatedString("hours",i.t(null,void 0,n(2359))),O=new o.TranslatedString("hours from",i.t(null,void 0,n(82267))),z=new o.TranslatedString("hours to",i.t(null,void 0,n(15600))),q=new o.TranslatedString("days",i.t(null,void 0,n(35813))),B=new o.TranslatedString("days from",i.t(null,void 0,n(59215))),G=new o.TranslatedString("days to",i.t(null,void 0,n(89919))),J=new o.TranslatedString("weeks",i.t(null,void 0,n(45537))),K=new o.TranslatedString("weeks from",i.t(null,void 0,n(92859))),Q=new o.TranslatedString("weeks to",i.t(null,void 0,n(44127))),Z=new o.TranslatedString("months",i.t(null,void 0,n(95300))),ee=new o.TranslatedString("months from",i.t(null,void 0,n(17250))),te=new o.TranslatedString("months to",i.t(null,void 0,n(2828))),ne=(new o.TranslatedString("ranges","ranges"),[1,59]),ie=[1,59],oe=[1,24],re=[1,366],le=[1,52],se=[1,12];function ae(e,t,n){const i=[];if((0,a.isTicksEnabled)()){const o=(0,r.createCheckablePropertyDefinition)({checked:(0,r.convertToDefinitionProperty)(e,t.ticks,p.format({title:n}))},{id:"IntervalsVisibilitiesTicks",title:x});i.push(o)}if((0,s.isSecondsEnabled)()){const o=(0,r.createRangePropertyDefinition)({checked:(0,r.convertToDefinitionProperty)(e,t.seconds,u.format({title:n})),from:(0,r.convertToDefinitionProperty)(e,t.secondsFrom,h.format({title:n})),to:(0,r.convertToDefinitionProperty)(e,t.secondsTo,y.format({title:n}))},{id:"IntervalsVisibilitiesSecond",title:U,min:new l.WatchedValue(ne[0]),max:new l.WatchedValue(ne[1])});i.push(o)}const o=(0,r.createRangePropertyDefinition)({checked:(0,r.convertToDefinitionProperty)(e,t.minutes,m.format({title:n})),from:(0,r.convertToDefinitionProperty)(e,t.minutesFrom,w.format({title:n})),to:(0,r.convertToDefinitionProperty)(e,t.minutesTo,f.format({title:n}))},{id:"IntervalsVisibilitiesMinutes",title:I,min:new l.WatchedValue(ie[0]),max:new l.WatchedValue(ie[1])}),d=(0,r.createRangePropertyDefinition)({checked:(0,r.convertToDefinitionProperty)(e,t.hours,v.format({title:n})),from:(0,r.convertToDefinitionProperty)(e,t.hoursFrom,P.format({title:n})),to:(0,r.convertToDefinitionProperty)(e,t.hoursTo,g.format({title:n}))},{id:"IntervalsVisibilitiesHours",title:M,min:new l.WatchedValue(oe[0]),max:new l.WatchedValue(oe[1])}),c=(0,r.createRangePropertyDefinition)({checked:(0,r.convertToDefinitionProperty)(e,t.days,T.format({title:n})),from:(0,r.convertToDefinitionProperty)(e,t.daysFrom,b.format({title:n})),to:(0,
r.convertToDefinitionProperty)(e,t.daysTo,S.format({title:n}))},{id:"IntervalsVisibilitiesDays",title:L,min:new l.WatchedValue(re[0]),max:new l.WatchedValue(re[1])});i.push(o,d,c);const R=(0,r.createRangePropertyDefinition)({checked:(0,r.convertToDefinitionProperty)(e,t.weeks,C.format({title:n})),from:(0,r.convertToDefinitionProperty)(e,t.weeksFrom,k.format({title:n})),to:(0,r.convertToDefinitionProperty)(e,t.weeksTo,V.format({title:n}))},{id:"IntervalsVisibilitiesWeeks",title:F,min:new l.WatchedValue(le[0]),max:new l.WatchedValue(le[1])}),N=(0,r.createRangePropertyDefinition)({checked:(0,r.convertToDefinitionProperty)(e,t.months,W.format({title:n})),from:(0,r.convertToDefinitionProperty)(e,t.monthsFrom,D.format({title:n})),to:(0,r.convertToDefinitionProperty)(e,t.monthsTo,_.format({title:n}))},{id:"IntervalsVisibilitiesMonths",title:A,min:new l.WatchedValue(se[0]),max:new l.WatchedValue(se[1])});return i.push(R,N),{definitions:i}}function de(e,t){const n=[];if((0,a.isTicksEnabled)()){const i=(0,r.createCheckablePropertyDefinition)({checked:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.ticks),R,t)},{id:"IntervalsVisibilitiesTicks",title:x});n.push(i)}if((0,s.isSecondsEnabled)()){const i=(0,r.createRangePropertyDefinition)({checked:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.seconds),N,t),from:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.secondsFrom),E,t),to:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.secondsTo),X,t)},{id:"IntervalsVisibilitiesSecond",title:U,min:new l.WatchedValue(ne[0]),max:new l.WatchedValue(ne[1])});n.push(i)}const i=(0,r.createRangePropertyDefinition)({checked:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.minutes),Y,t),from:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.minutesFrom),H,t),to:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.minutesTo),j,t)},{id:"IntervalsVisibilitiesMinutes",title:I,min:new l.WatchedValue(ie[0]),max:new l.WatchedValue(ie[1])}),o=(0,r.createRangePropertyDefinition)({checked:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.hours),$,t),from:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.hoursFrom),O,t),to:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.hoursTo),z,t)},{id:"IntervalsVisibilitiesHours",title:M,min:new l.WatchedValue(oe[0]),max:new l.WatchedValue(oe[1])}),p=(0,r.createRangePropertyDefinition)({checked:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.days),q,t),from:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.daysFrom),B,t),to:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.daysTo),G,t)},{id:"IntervalsVisibilitiesDays",title:L,min:new l.WatchedValue(re[0]),max:new l.WatchedValue(re[1])});n.push(i,o,p);const u=(0,r.createRangePropertyDefinition)({checked:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.weeks),J,t),
from:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.weeksFrom),K,t),to:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.weeksTo),Q,t)},{id:"IntervalsVisibilitiesWeeks",title:F,min:new l.WatchedValue(le[0]),max:new l.WatchedValue(le[1])}),h=(0,r.createRangePropertyDefinition)({checked:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.months),Z,t),from:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.monthsFrom),ee,t),to:new c.CollectiblePropertyUndoWrapper(new d.LineToolCollectedProperty(e.monthsTo),te,t)},{id:"IntervalsVisibilitiesMonths",title:A,min:new l.WatchedValue(se[0]),max:new l.WatchedValue(se[1])});return n.push(u,h),{definitions:n}}},66567:(e,t,n)=>{n.d(t,{CollectiblePropertyUndoWrapper:()=>a});var i=n(50151),o=n(11542),r=n(95804),l=n(43337);const s=new r.TranslatedString("change {propertyName} property",o.t(null,void 0,n(25167)));class a extends l.Property{constructor(e,t,n){super(),this._isProcess=!1,this._listenersMappers=[],this._valueApplier={applyValue:(e,t)=>{this._propertyApplier.setProperty(e,t,s)}},this._baseProperty=e,this._propertyApplier=n,this._propertyName=t}destroy(){this._baseProperty.destroy(),super.destroy()}value(){return this._baseProperty.value()}setValue(e,t){this._propertyApplier.beginUndoMacro(s.format({propertyName:this._propertyName})),this._isProcess=!0,this._baseProperty.setValue(e,void 0,this._valueApplier),this._isProcess=!1,this._propertyApplier.endUndoMacro(),this._listenersMappers.forEach((e=>{e.method.call(e.obj,this,"")}))}subscribe(e,t){const n=()=>{this._isProcess||t.call(e,this,"")};this._listenersMappers.push({obj:e,method:t,callback:n}),this._baseProperty.subscribe(e,n)}unsubscribe(e,t){const n=(0,i.ensureDefined)(this._listenersMappers.find((n=>n.obj===e&&n.method===t))?.callback);this._baseProperty.unsubscribe(e,n)}unsubscribeAll(e){this._baseProperty.unsubscribeAll(e)}}},81634:(e,t,n)=>{n.d(t,{PropertyApplierWithoutSavingChart:()=>o});var i=n(13896);class o{constructor(e){this._undoModelSupplier=e}setProperty(e,t,n){this._undoModelSupplier().setProperty(e,t,n,i.lineToolsDoNotAffectChartInvalidation)}beginUndoMacro(e){return this._undoModelSupplier().beginUndoMacro(e)}endUndoMacro(){this._undoModelSupplier().endUndoMacro()}setWatchedValue(e,t,n){this._undoModelSupplier().undoHistory().setWatchedValue(e,t,n,i.lineToolsDoNotAffectChartInvalidation)}}}}]);