7 lines
19 KiB
JavaScript
7 lines
19 KiB
JavaScript
"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[3710],{67725:(e,t,i)=>{i.d(t,{createLineStyleDefinition:()=>g});var r=i(11542),n=i(95804),s=i(95338),o=i(91682);const l=new n.TranslatedString("change {toolName} line visibility",r.t(null,void 0,i(24550))),a=new n.TranslatedString("change {toolName} line width",r.t(null,void 0,i(19541))),c=new n.TranslatedString("change {toolName} line style",r.t(null,void 0,i(66429))),d=new n.TranslatedString("change {toolName} line color",r.t(null,void 0,i(24059))),u=new n.TranslatedString("change {toolName} line extending left",r.t(null,void 0,i(18773))),p=new n.TranslatedString("change {toolName} line left end",r.t(null,void 0,i(21474))),h=new n.TranslatedString("change {toolName} line extending right",r.t(null,void 0,i(43823))),_=new n.TranslatedString("change {toolName} line right end",r.t(null,void 0,i(54827))),f=r.t(null,void 0,i(3554)),v=r.t(null,void 0,i(61856)),y=r.t(null,void 0,i(87430));function g(e,t,i,r,n){const g={},P={id:`${(0,o.removeSpaces)(i.originalText())}${r}`,title:n&&n.line||f};return void 0!==t.showLine&&(g.checked=(0,s.convertToDefinitionProperty)(e,t.showLine,l.format({toolName:i}))),void 0!==t.lineWidth&&(g.width=(0,s.convertToDefinitionProperty)(e,t.lineWidth,a.format({toolName:i}))),void 0!==t.lineStyle&&(g.style=(0,s.convertToDefinitionProperty)(e,t.lineStyle,c.format({toolName:i}))),void 0!==t.lineColor&&(g.color=(0,s.getColorDefinitionProperty)(e,t.lineColor,null,d.format({toolName:i}))),void 0!==t.extendLeft&&(g.extendLeft=(0,s.convertToDefinitionProperty)(e,t.extendLeft,u.format({toolName:i})),P.extendLeftTitle=n&&n.extendLeftTitle||v),void 0!==t.leftEnd&&(g.leftEnd=(0,s.convertToDefinitionProperty)(e,t.leftEnd,p.format({toolName:i}))),void 0!==t.extendRight&&(g.extendRight=(0,s.convertToDefinitionProperty)(e,t.extendRight,h.format({toolName:i})),P.extendRightTitle=n&&n.extendRightTitle||y),void 0!==t.rightEnd&&(g.rightEnd=(0,s.convertToDefinitionProperty)(e,t.rightEnd,_.format({toolName:i}))),(0,s.createLinePropertyDefinition)(g,P)}},14472:(e,t,i)=>{i.r(t),i.d(t,{LineDataSourceDefinitionsViewModel:()=>b,LineDataSourceTabTypes:()=>r,pointPriceBarTitle:()=>P});var r,n=i(50151),s=i(11542),o=i(95804),l=(i(40167),i(95338)),a=i(60567),c=i(22613),d=i(73863),u=i(97578),p=i(81634),h=i(36313);!function(e){e.Visibility="visibility",e.Coordinates="coordinates",e.Style="style",e.Text="text",e.Inputs="inputs"}(r||(r={}));const _=s.t(null,void 0,i(40091)),f=s.t(null,void 0,i(78930)),v=s.t(null,void 0,i(92516)),y=s.t(null,void 0,i(70320)),g=s.t(null,void 0,i(21429)),P=s.t(null,{context:"linetool point"},i(80166));class b{constructor(e,t){this._yCoordinateStepWV=null,this._propertyPages=[],this._source=t,this._undoModel=e,this._ownerSource=(0,n.ensureNotNull)(this._source.ownerSource()),this._propertyApplier=new p.PropertyApplierWithoutSavingChart((()=>e)),this._createPropertyRages()}destroy(){null!==this._yCoordinateStepWV&&(this._source.ownerSourceChanged().unsubscribeAll(this),
|
|
this._ownerSource.priceStepChanged().unsubscribeAll(this)),this._source.pointAdded().unsubscribeAll(this),this._propertyPages.forEach((e=>{(0,l.destroyDefinitions)(e.definitions.value())}))}propertyPages(){return Promise.resolve(this._propertyPages)}_createPropertyRages(){this._propertyPages=[];const e=this._createInputsPropertyPage();null!==e&&this._propertyPages.push(e);const t=this._createStylePropertyPage();null!==t&&this._propertyPages.push(t);const i=this._createTextPropertyPage();null!==i&&this._propertyPages.push(i);const r=this._createCoordinatesPropertyPage();null!==r&&(r.visible=this._source.hasEditableCoordinates(),this._propertyPages.push(r));const n=this._createVisibilitiesPropertyPage();this._propertyPages.push(n)}_createVisibilitiesPropertyPage(){const e=this._source.properties().childs().intervalsVisibilities.childs();return(0,a.createPropertyPage)((0,d.getIntervalsVisibilitiesPropertiesDefinitions)(this._propertyApplier,e,new o.TranslatedString(this._source.name(),this._source.title(h.TitleDisplayTarget.StatusLine,!0))),"visibility",_)}_createCoordinatesPropertyPage(){const e=this._coordinatesPropertyDefinitions();return null!==e?(e.definitions.length<this._source.pointsCount()&&this._source.pointAdded().subscribe(this,this._updateCoordinatesPropertyDefinitons),(0,a.createPropertyPage)(e,"coordinates",f)):null}_getYCoordinateStepWV(){return null===this._yCoordinateStepWV&&(this._yCoordinateStepWV=new c.WatchedValue(function(e){if(null!==e){const t=e.priceStep();if(null!==t)return t}return 1}(this._source.ownerSource())),this._ownerSource.priceStepChanged().subscribe(this,(()=>this._updateYCoordinateStep())),this._source.ownerSourceChanged().subscribe(this,(()=>{this._ownerSource.priceStepChanged().unsubscribeAll(this),this._ownerSource=(0,n.ensureNotNull)(this._source.ownerSource()),this._ownerSource.priceStepChanged().subscribe(this,(()=>this._updateYCoordinateStep()))}))),this._yCoordinateStepWV}_coordinatesPropertyDefinitions(){const e=this._source.points(),t=this._source.pointsProperty().childs().points,i=[],r=this._getYCoordinateStepWV();return e.forEach(((e,n)=>{const s=t[n].childs();s&&i.push((0,u.getCoordinatesPropertiesDefinitions)(this._propertyApplier,s,e,r,P.format({count:(n+1).toString()}),this._source.name()))})),{definitions:i}}_createStylePropertyPage(){const e=this._stylePropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"style",v):null}_stylePropertyDefinitions(){return null}_createTextPropertyPage(){const e=this._textPropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"text",y):null}_textPropertyDefinitions(){return null}_createInputsPropertyPage(){const e=this._inputsPropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"inputs",g):null}_inputsPropertyDefinitions(){return null}_updateYCoordinateStep(){const e=this._ownerSource.priceStep();this._getYCoordinateStepWV().setValue(e||1)}_updateCoordinatesPropertyDefinitons(){const e=this._coordinatesPropertyDefinitions();if(null!==e){(0,
|
|
n.ensureDefined)(this._propertyPages.find((e=>"coordinates"===e.id))).definitions.setValue(e.definitions),this._source.points().length===this._source.pointsCount()&&this._source.pointAdded().unsubscribeAll(this)}}}},40226:(e,t,i)=>{i.d(t,{LevelsProperty:()=>f});var r=i(90054),n=i(16738),s=i(87465),o=i(78176),l=i(60973);const a={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:()=>Object(),unpack:()=>[]}};function c(e,t,i,r){return r.push(i[t]),r}function d(e,t,i,r){return r[t]=i[e],r}function u(){return[]}function p(){return{}}function h(e,t,i){return i.prefixes.forEach((r=>{const n=r+"level";for(let r=i.range[0];r<=i.range[1];r++)if(e[n+r]&&(0,s.isSameType)(e[n+r],t.typecheck())){let s=t.tpl();i.names.forEach(((i,o)=>{s=t.fill(""+o,i,e[n+r],s)})),e[n+r]=s}})),e}function _(e,t,i){return i(e,{tpl:p,fill:d,typecheck:t.typecheck.unpack},t)}class f extends o.DefaultProperty{constructor(e){const{levelsIterator:t=h,map:i={},...r}=e,n={...a,...i};r.state&&(r.state=_(r.state,n,t)),super(r),this._map=n,this._levelsIterator=t}state(e,t,i){const r=super.state(e,t);return i?r:(n=r,s=this._map,(0,this._levelsIterator)(n,{tpl:u,fill:c,typecheck:s.typecheck.pack},s));var n,s}preferences(){return(0,o.extractState)(this.state(this._excludedDefaultsKeys,void 0,!0),this._allDefaultsKeys)}applyTemplate(e,t){this.mergeAndFire((0,o.extractState)((0,n.default)((0,r.default)(t),_(e,this._map,this._levelsIterator)),this._allStateKeys,this._excludedTemplateKeys))}saveDefaults(){this._useUserPreferences&&(0,l.saveDefaults)(this._defaultName,this.preferences())}clone(){return new f(this._options())}merge(e,t){return super.merge(this._map?_(e,this._map,this._levelsIterator):e,t)}_options(){return{...super._options(),map:{...this._map},levelsIterator:this._levelsIterator}}}},44005:(e,t,i)=>{i.d(t,{CollectibleColorPropertyDirectWrapper:()=>l,CollectibleColorPropertyUndoWrapper:()=>o});var r=i(50151),n=i(43337);class s 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,"")},r={obj:e,method:t,callback:i};this._listenersMappers.push(r),this._baseProperty.subscribe(e,i)}unsubscribe(e,t){const i=(0,r.ensureDefined)(this._listenersMappers.find((i=>i.obj===e&&i.method===t))?.callback);this._baseProperty.unsubscribe(e,i)}unsubscribeAll(e){this._baseProperty.unsubscribeAll(e)}}class o extends s{constructor(e,t,i){super(e),this._propertyApplier=t,this._undoText=i}_applyValue(e,t){this._propertyApplier.setProperty(e,t,this._undoText)}}class l extends s{_applyValue(e,t){e.setValue(t)}}},76806:(e,t,i)=>{i.d(t,{
|
|
LineToolPaneViewFibWithLabels:()=>u,labelEdgeOffset:()=>d});var r=i(50151),n=i(4753),s=i(2383),o=i(56265),l=i(84617),a=i(2268),c=i(24961);const d=4;class u extends a.InplaceTextLineSourcePaneView{constructor(e,t,i,l){super(e,t,i,l),this._labelsRenderers={},this._numericFormatter=(0,o.getNumericFormatter)(),this._percentageFormatter=(0,o.getPercentageFormatter)(),this._textRenderers={},this._inplaceEditLevelIndex=1;for(let t=1;t<=e.levelsCount();t++)this._labelsRenderers[t]=new n.TextRenderer(void 0,new s.HitTestResult(s.HitTarget.MovePoint,{activeItem:t}));if(i&&l){for(let t=1;t<=e.levelsCount();t++){const e=new s.HitTestResult(s.HitTarget.MovePoint,{...(0,a.inplaceEditHandlers)(this._tryActivateEditMode.bind(this,t)),activeItem:t});this._textRenderers[t]=new c.LineToolTextRenderer(void 0,e)}this._source.setAdditionalCursorData((()=>{const e=(0,r.ensureDefined)(this._textRenderers[this._inplaceEditLevelIndex]);return{color:this._source.editableTextStyle().cursorColor,...e.getTextInfo()}}),(e=>(0,r.ensureDefined)(this._textRenderers[this._inplaceEditLevelIndex]).positionToCoordinate(e)))}}_tryActivateEditMode(e,t){this._inplaceEditLevelIndex=e,super._tryActivateEditMode(e,t)}_activateEditMode(e){const t=(0,r.ensureDefined)(this._textRenderers[this._inplaceEditLevelIndex]);this._updateInplaceText(t.getTextInfo()),super._activateEditMode(e)}_updateLabelForLevel(e){const t=this._labelsRenderers[e.levelIndex];if(void 0===t)return null;const i=this._source.priceScale();if(!i)return null;const r=this._source.ownerSource()?.firstValue();if(null==r)return null;const n=this._source.properties(),s=Boolean(n.showCoeffs?.value()),o=Boolean(n.showPrices?.value());if(!s&&!o)return null;const l=n["level"+e.levelIndex].coeff.value();let a="";if(s){a+=n.coeffsAsPercents?.value()??!1?this._percentageFormatter.format(100*l,{signPositive:!1,tailSize:2}):this._numericFormatter.format(l)}return o&&(a+=" ("+i.formatPrice(e.price,r)+")"),this._updateRendererLabel(e,t,a),t}_updateRendererLabel(e,t,i){if(!i&&void 0===e.decorator)return null;const{leftPoint:r,rightPoint:s,horzAlign:o,extendLeft:a,extendRight:c,...u}=e,p=this._source.properties(),[h,_]=(0,n.getTextAlignInBox)({horzAlign:o,extendLeft:a,extendRight:c,width:this._model.timeScale().width(),leftPoint:r,rightPoint:s});return t.setData({points:[h],text:i,horzAlign:_,offsetX:d,offsetY:0,font:l.CHART_FONT_FAMILY,fontSize:p.labelFontSize?.value()??12,...u}),t}}},2709:(e,t,i)=>{i.r(t),i.d(t,{LineToolFibSpeedResistanceArcs:()=>j});var r=i(50151),n=i(11542),s=i(95804),o=i(40226),l=i(65045),a=i(13896),c=i(63117),d=i(67725),u=i(95338),p=i(14472),h=i(91682),_=i(44005)
|
|
;const f=new s.TranslatedString("change {title} level {index} line visibility",n.t(null,void 0,i(51403))),v=new s.TranslatedString("change {title} levels visibility",n.t(null,void 0,i(54517))),y=new s.TranslatedString("change {title} level {index} line color",n.t(null,void 0,i(664))),g=new s.TranslatedString("change {title} level {index} line width",n.t(null,void 0,i(97870))),P=new s.TranslatedString("change {title} level {index} line coeff",n.t(null,void 0,i(27154))),b=new s.TranslatedString("change {title} all lines color",n.t(null,void 0,i(59577))),T=new s.TranslatedString("change {title} background visibility",n.t(null,void 0,i(30839))),m=new s.TranslatedString("change {title} background transparency",n.t(null,void 0,i(13783))),w=new s.TranslatedString("change {title} full circles visibility",n.t(null,void 0,i(30484))),x=n.t(null,void 0,i(51574)),S=n.t(null,void 0,i(28683)),C=n.t(null,void 0,i(79468)),D=n.t(null,void 0,i(79650)),L=n.t(null,void 0,i(95279));class A extends p.LineDataSourceDefinitionsViewModel{_stylePropertyDefinitions(){const e=[],t=this._source.properties().childs(),i=this._source.name(),n=(0,h.removeSpaces)(i),o=new s.TranslatedString(i,this._source.translatedType()),l=t.trendline.childs(),a=(0,d.createLineStyleDefinition)(this._propertyApplier,{showLine:l.visible,lineColor:l.color,lineStyle:l.linestyle,lineWidth:l.linewidth},o,"TrendLine",{line:x});e.push(a);const c=this._source.levelsCount();for(let i=1;i<=c;i++){const r=t[`level${i}`].childs(),s=(0,u.createLeveledLinePropertyDefinition)({checked:(0,u.convertToDefinitionProperty)(this._propertyApplier,r.visible,f.format({title:o,index:i})),color:(0,u.getColorDefinitionProperty)(this._propertyApplier,r.color,null,y.format({title:o,index:i})),width:(0,u.convertToDefinitionProperty)(this._propertyApplier,r.linewidth,g.format({title:o,index:i})),level:(0,u.convertToDefinitionProperty)(this._propertyApplier,r.coeff,P.format({title:o,index:i}))},{id:`${n}LineLevel${i}`});e.push(s)}const p=(0,u.createColorPropertyDefinition)({color:(0,u.getColorDefinitionProperty)(this._propertyApplier,new _.CollectibleColorPropertyUndoWrapper((0,r.ensureNotNull)(this._source.lineColorsProperty()),this._propertyApplier,null),null,b.format({title:o}),!0)},{id:`${n}AllLineColor`,title:S});e.push(p);const A=(0,u.createTransparencyPropertyDefinition)({checked:(0,u.convertToDefinitionProperty)(this._propertyApplier,t.fillBackground,T.format({title:o})),transparency:(0,u.convertToDefinitionProperty)(this._propertyApplier,t.transparency,m.format({title:o}))},{id:`${n}Background`,title:C});e.push(A);const I=(0,u.createCheckablePropertyDefinition)({checked:(0,u.convertToDefinitionProperty)(this._propertyApplier,t.showCoeffs,v.format({title:o}))},{id:`${n}Levels`,title:D});e.push(I);const R=(0,u.createCheckablePropertyDefinition)({checked:(0,u.convertToDefinitionProperty)(this._propertyApplier,t.fullCircles,w.format({title:o}))},{id:`${n}FullCircles`,title:L});return e.push(R),{definitions:e}}}
|
|
var I=i(10555),R=i(50605),k=i(77914),V=i(2383),M=i(94602),E=i(25672),N=i(80819),W=i(76806),F=i(52859),H=i(4539),B=i(20820);class $ extends B.MediaCoordinatesPaneRenderer{constructor(e,t,i){super(),this._data=e,this._hittest=t||new V.HitTestResult(V.HitTarget.MovePoint),this._backHittest=i||new V.HitTestResult(V.HitTarget.MovePointBackground)}hitTest(e){const t=this._data;if(null===t)return null;if((0,k.sign)(e.y-t.center.y)!==t.dir&&!t.fullCircles)return null;const i=e.subtract(t.center).length(),r=(0,H.interactionTolerance)().curve;return Math.abs(i-t.radius)<r?this._hittest:t.hittestOnBackground&&Math.abs(i)<=t.radius+r?this._backHittest:null}_drawImpl(e){const t=this._data;if(null===t)return;const i=e.context;i.lineCap="round",i.strokeStyle=t.color,i.lineWidth=t.linewidth,i.translate(t.center.x,t.center.y),i.beginPath(),t.fullCircles?i.arc(0,0,t.radius,2*Math.PI,0,!1):t.dir>0?i.arc(0,0,t.radius,0,Math.PI,!1):i.arc(0,0,t.radius,Math.PI,0,!1),i.stroke(),t.fillBackground&&(t.radius2&&(t.fullCircles?i.arc(0,0,t.radius2,2*Math.PI,0,!0):t.dir>0?i.arc(0,0,t.radius2,Math.PI,0,!0):i.arc(0,0,t.radius2,0,Math.PI,!0)),i.fillStyle=(0,F.generateColor)(t.color,t.transparency,!0),i.fill())}}class z extends W.LineToolPaneViewFibWithLabels{constructor(){super(...arguments),this._trendLineRenderer=new N.TrendLineRenderer,this._renderer=null,this._levels=[]}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_updateImpl(e){if(super._updateImpl(e),this._renderer=null,this._points.length<2)return;const t=this._source.priceScale();if(!t||t.isEmpty()||this._model.timeScale().isEmpty())return;const i=this._source.ownerSource()?.firstValue();if(null==i)return;const n=this._points[0],s=this._points[1],o=n.subtract(s).length();this._levels=[];const l=this._source.properties().childs(),a=this._source.levelsCount();for(let e=1;e<=a;e++){const t="level"+e,i=(0,r.ensureDefined)(this._source.properties().child(t)).childs();if(!i.visible.value())continue;const l=i.coeff.value(),a=i.color.value(),c=Math.abs(s.subtract(n).length()*l),d=(0,k.sign)(s.y-n.y),u=new I.Point(n.x,n.y+d*o*Math.abs(l));this._levels.push({color:a,radius:c,dir:d,labelPoint:u,linewidth:i.linewidth.value(),linestyle:i.linestyle.value(),index:e})}if(this._points.length<2)return;const c=new M.CompositeRenderer,d=l.fillBackground.value(),u=l.transparency.value();for(let e=0;e<this._levels.length;e++){const t=this._levels[e],i={center:n,color:t.color,linewidth:t.linewidth,radius:t.radius,dir:t.dir,transparency:u,fillBackground:d,hittestOnBackground:!0,fullCircles:l.fullCircles.value(),radius2:e>0?this._levels[e-1].radius:void 0},r=new V.HitTestResult(V.HitTarget.MovePoint,void 0,t.index);c.append(new $(i,r));const s=this._updateLabelForLevel({levelIndex:this._levels[e].index,leftPoint:this._levels[e].labelPoint,rightPoint:this._levels[e].labelPoint,price:0,color:this._levels[e].color,horzAlign:R.HorizontalAlign.Left,vertAlign:R.VerticalAlign.Middle});null!==s&&c.append(s)}const p=l.trendline.childs();if(p.visible.value()){const e={
|
|
points:[this._points[0],this._points[1]],color:p.color.value(),linewidth:p.linewidth.value(),linestyle:p.linestyle.value(),extendleft:!1,extendright:!1,leftend:E.LineEnd.Normal,rightend:E.LineEnd.Normal};this._trendLineRenderer.setData(e),c.append(this._trendLineRenderer)}this.addAnchors(c),this._renderer=c}}const Y=new s.TranslatedString("erase level line",n.t(null,void 0,i(77114)));var O;!function(e){e[e.LevelsCount=11]="LevelsCount"}(O||(O={}));class j extends c.InplaceTextLineDataSource{constructor(e,t,i,r){super(e,t??j.createProperties(e.backgroundTheme().spawnOwnership()),i,r),this._setPaneViews([new z(this,this._model)])}levelsCount(){return 11}pointsCount(){return 2}name(){return"Fib Speed Resistance Arcs"}processErase(e,t){const i=`level${t}`,n=(0,r.ensureDefined)(this.properties().child(i)).childs().visible;e.setProperty(n,!1,Y,a.lineToolsDoNotAffectChartInvalidation)}editableTextProperties(){(0,r.assert)(!1,"unexpected method call")}static createProperties(e,t){const i=new o.LevelsProperty({defaultName:"linetoolfibspeedresistancearcs",state:t,map:{range:[1,11]},theme:e});return this._configureProperties(i),i}async _getPropertyDefinitionsViewModelClass(){return A}static _configureProperties(e){super._configureProperties(e);const t=e.childs().trendline.childs(),i=[t.linewidth],n=[t.color];for(let t=1;t<=11;t++){const s=(0,r.ensureDefined)(e.child(`level${t}`)).childs();i.push(s.linewidth),n.push(s.color)}e.addChild("linesColors",new l.LineToolColorsProperty(n)),e.addChild("linesWidths",new l.LineToolWidthsProperty(i))}}},24961:(e,t,i)=>{i.d(t,{LineToolTextRenderer:()=>n});var r=i(4753);class n extends r.TextRenderer{getTextInfo(){const e=this._getInternalData(),t=this.fontStyle(),i=this._getFontInfo();return{...e,lineHeight:this.lineHeight(),lineSpacing:this.lineSpacing(),font:t,fontSize:i.fontSize,centerRotation:this.centerTextRotation()??void 0}}setCursorType(e){this._hitTest.data()?.cursorType!==e&&this._hitTest.mergeData({cursorType:e})}}}}]); |