Files
ai/web/public/charting_library/bundles/2891.ac7f12fc1eff206762f9.js

5 lines
13 KiB
JavaScript

"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[2891],{91445:(e,t,o)=>{o.d(t,{createTextStyleDefinition:()=>w});var i=o(11542),r=o(95804),n=o(95338),s=o(91682);const a=new r.TranslatedString("change {toolName} text visibility",i.t(null,void 0,o(56634))),l=new r.TranslatedString("change {toolName} text color",i.t(null,void 0,o(64500))),d=new r.TranslatedString("change {toolName} text font size",i.t(null,void 0,o(21781))),c=new r.TranslatedString("change {toolName} text font bold",i.t(null,void 0,o(24701))),u=new r.TranslatedString("change {toolName} text font italic",i.t(null,void 0,o(42694))),p=new r.TranslatedString("change {toolName} text",i.t(null,void 0,o(66668))),h=new r.TranslatedString("change {toolName} labels alignment vertical",i.t(null,void 0,o(31689))),g=new r.TranslatedString("change {toolName} labels alignment horizontal",i.t(null,void 0,o(88277))),_=new r.TranslatedString("change {toolName} labels direction",i.t(null,void 0,o(61160))),y=new r.TranslatedString("change {toolName} text background visibility",i.t(null,void 0,o(31133))),b=new r.TranslatedString("change {toolName} text background color",i.t(null,void 0,o(22231))),m=new r.TranslatedString("change {toolName} text border visibility",i.t(null,void 0,o(58704))),f=new r.TranslatedString("change {toolName} text border width",i.t(null,void 0,o(35423))),P=new r.TranslatedString("change {toolName} text border color",i.t(null,void 0,o(36666))),v=new r.TranslatedString("change {toolName} text wrap",i.t(null,void 0,o(39587))),T=i.t(null,void 0,o(79468)),C=i.t(null,void 0,o(38408)),x=i.t(null,void 0,o(7560)),S=i.t(null,void 0,o(6060));function w(e,t,o,i){const r={},w={id:`${(0,s.removeSpaces)(o.originalText())}Text`,title:i.customTitles&&i.customTitles.text||"",placeholder:i.placeholder??S};if(void 0===t.showText||i.hideTextCheckbox||(r.checked=(0,n.convertToDefinitionProperty)(e,t.showText,a.format({toolName:o}))),void 0!==t.textColor&&(r.color=(0,n.getColorDefinitionProperty)(e,t.textColor,t.transparency||null,l.format({toolName:o}))),void 0!==t.fontSize&&(r.size=(0,n.convertToDefinitionProperty)(e,t.fontSize,d.format({toolName:o}))),void 0!==t.bold&&(r.bold=(0,n.convertToDefinitionProperty)(e,t.bold,c.format({toolName:o}))),void 0!==t.italic&&(r.italic=(0,n.convertToDefinitionProperty)(e,t.italic,u.format({toolName:o}))),void 0!==t.text){const s=p.format({toolName:o});r.text=(0,n.convertToDefinitionProperty)(e,t.text,s,void 0),w.isEditable=Boolean(i.isEditable),w.isMultiLine=Boolean(i.isMultiLine)}if(void 0!==t.vertLabelsAlign&&(r.alignmentVertical=(0,n.convertToDefinitionProperty)(e,t.vertLabelsAlign,h.format({toolName:o})),w.alignmentVerticalItems=i.alignmentVerticalItems),void 0!==t.horzLabelsAlign&&(r.alignmentHorizontal=(0,n.convertToDefinitionProperty)(e,t.horzLabelsAlign,g.format({toolName:o})),w.alignmentHorizontalItems=i.alignmentHorizontalItems),void 0!==t.textOrientation&&(r.orientation=(0,n.convertToDefinitionProperty)(e,t.textOrientation,_.format({toolName:o}))),
void 0!==t.backgroundVisible&&(r.backgroundVisible=(0,n.convertToDefinitionProperty)(e,t.backgroundVisible,y.format({toolName:o}))),void 0!==t.backgroundColor){let i=null;void 0!==t.backgroundTransparency&&(i=t.backgroundTransparency),r.backgroundColor=(0,n.getColorDefinitionProperty)(e,t.backgroundColor,i,b.format({toolName:o}))}return void 0===t.backgroundVisible&&void 0===t.backgroundColor||(w.backgroundTitle=i.customTitles&&i.customTitles.backgroundTitle||T),void 0!==t.borderVisible&&(r.borderVisible=(0,n.convertToDefinitionProperty)(e,t.borderVisible,m.format({toolName:o}))),void 0!==t.borderWidth&&(r.borderWidth=(0,n.convertToDefinitionProperty)(e,t.borderWidth,f.format({toolName:o}))),void 0!==t.borderColor&&(r.borderColor=(0,n.getColorDefinitionProperty)(e,t.borderColor,null,P.format({toolName:o}))),void 0===t.borderVisible&&void 0===t.borderColor&&void 0===t.borderWidth||(w.borderTitle=i.customTitles&&i.customTitles.borderTitle||C),void 0!==t.wrap&&(r.wrap=(0,n.convertToDefinitionProperty)(e,t.wrap,v.format({toolName:o})),w.wrapTitle=i.customTitles&&i.customTitles.wrapTitle||x),(0,n.createTextPropertyDefinition)(r,w)}},14472:(e,t,o)=>{o.r(t),o.d(t,{LineDataSourceDefinitionsViewModel:()=>P,LineDataSourceTabTypes:()=>i,pointPriceBarTitle:()=>f});var i,r=o(50151),n=o(11542),s=o(95804),a=(o(40167),o(95338)),l=o(60567),d=o(22613),c=o(73863),u=o(97578),p=o(81634),h=o(36313);!function(e){e.Visibility="visibility",e.Coordinates="coordinates",e.Style="style",e.Text="text",e.Inputs="inputs"}(i||(i={}));const g=n.t(null,void 0,o(40091)),_=n.t(null,void 0,o(78930)),y=n.t(null,void 0,o(92516)),b=n.t(null,void 0,o(70320)),m=n.t(null,void 0,o(21429)),f=n.t(null,{context:"linetool point"},o(80166));class P{constructor(e,t){this._yCoordinateStepWV=null,this._propertyPages=[],this._source=t,this._undoModel=e,this._ownerSource=(0,r.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,a.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 o=this._createTextPropertyPage();null!==o&&this._propertyPages.push(o);const i=this._createCoordinatesPropertyPage();null!==i&&(i.visible=this._source.hasEditableCoordinates(),this._propertyPages.push(i));const r=this._createVisibilitiesPropertyPage();this._propertyPages.push(r)}_createVisibilitiesPropertyPage(){const e=this._source.properties().childs().intervalsVisibilities.childs();return(0,l.createPropertyPage)((0,
c.getIntervalsVisibilitiesPropertiesDefinitions)(this._propertyApplier,e,new s.TranslatedString(this._source.name(),this._source.title(h.TitleDisplayTarget.StatusLine,!0))),"visibility",g)}_createCoordinatesPropertyPage(){const e=this._coordinatesPropertyDefinitions();return null!==e?(e.definitions.length<this._source.pointsCount()&&this._source.pointAdded().subscribe(this,this._updateCoordinatesPropertyDefinitons),(0,l.createPropertyPage)(e,"coordinates",_)):null}_getYCoordinateStepWV(){return null===this._yCoordinateStepWV&&(this._yCoordinateStepWV=new d.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,r.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,o=[],i=this._getYCoordinateStepWV();return e.forEach(((e,r)=>{const n=t[r].childs();n&&o.push((0,u.getCoordinatesPropertiesDefinitions)(this._propertyApplier,n,e,i,f.format({count:(r+1).toString()}),this._source.name()))})),{definitions:o}}_createStylePropertyPage(){const e=this._stylePropertyDefinitions();return null!==e?(0,l.createPropertyPage)(e,"style",y):null}_stylePropertyDefinitions(){return null}_createTextPropertyPage(){const e=this._textPropertyDefinitions();return null!==e?(0,l.createPropertyPage)(e,"text",b):null}_textPropertyDefinitions(){return null}_createInputsPropertyPage(){const e=this._inputsPropertyDefinitions();return null!==e?(0,l.createPropertyPage)(e,"inputs",m):null}_inputsPropertyDefinitions(){return null}_updateYCoordinateStep(){const e=this._ownerSource.priceStep();this._getYCoordinateStepWV().setValue(e||1)}_updateCoordinatesPropertyDefinitons(){const e=this._coordinatesPropertyDefinitions();if(null!==e){(0,r.ensureDefined)(this._propertyPages.find((e=>"coordinates"===e.id))).definitions.setValue(e.definitions),this._source.points().length===this._source.pointsCount()&&this._source.pointAdded().unsubscribeAll(this)}}}},12891:(e,t,o)=>{o.r(t),o.d(t,{LineToolBalloon:()=>A});var i=o(50151),r=o(11542),n=o(78176),s=o(63117),a=o(43337),l=o(65045),d=o(95804),c=o(91445),u=o(14472);const p=r.t(null,void 0,o(70320));class h extends u.LineDataSourceDefinitionsViewModel{_textPropertyDefinitions(){const e=this._source.properties().childs();return{definitions:[(0,c.createTextStyleDefinition)(this._propertyApplier,{textColor:e.color,fontSize:e.fontsize,text:e.text,backgroundColor:e.backgroundColor,backgroundTransparency:e.transparency,borderColor:e.borderColor},new d.TranslatedString(this._source.name(),this._source.translatedType()),{isEditable:!0,isMultiLine:!0,customTitles:{text:p}})]}}}
var g,_=o(52859),y=o(49251),b=o(84617),m=o(54707),f=o(73914),P=o(94602),v=o(45801),T=o(2383),C=o(10555),x=o(6453),S=o(24640),w=o(33350),D=o(20820);!function(e){e[e.Radius=15]="Radius",e[e.TailApexXOffsetFromTextStart=20]="TailApexXOffsetFromTextStart",e[e.TailHeight=9]="TailHeight"}(g||(g={}));class N extends D.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._geometryCache={innerHeight:NaN,textHorizontalPadding:NaN,innerWidth:NaN,paddingLeft:NaN},this._geomertryCacheInvalidated=!0,this._data=null}setData(e){this._data=e,this._geomertryCacheInvalidated=!0}hitTest(e){if(null===this._data||0===this._data.points.length)return null;const t=this._data.points[0].x-(this._geometryCache.paddingLeft+20),o=this._data.points[0].y-(this._geometryCache.innerHeight+9),i=(0,C.box)(new C.Point(t,o),new C.Point(t+this._geometryCache.innerWidth,o+this._geometryCache.innerHeight));return(0,x.pointInBox)(e,i)?new T.HitTestResult(T.HitTarget.MovePoint,{areaName:T.AreaName.Text}):null}_drawImpl(e){if(null===this._data||0===this._data.points.length)return;const t=e.context;t.font=this._data.font;const o=this._measureInfo(t,this._data.label,this._data.fontSize),{paddingLeft:i,innerHeight:r,innerWidth:n,textHorizontalPadding:s}=o;t.textAlign=(0,S.isRtl)()?"right":"left";const a=this._data.points[0].x-(i+20),l=this._data.points[0].y-(r+9);t.translate(a,l),t.beginPath(),t.moveTo(24,r),t.lineTo(15,r),t.arcTo(-1e3,0,1e3,0,r/2),t.lineTo(n-15,0),t.arcTo(1e3,r,-1e3,r,r/2),t.lineTo(33,r),t.quadraticCurveTo(33,r+4,35,r+9),t.quadraticCurveTo(27,r+6,24,r),t.fillStyle=this._data.backgroundColor,t.fill(),t.strokeStyle=this._data.borderColor,t.lineWidth=2,t.stroke(),t.closePath(),t.textBaseline="middle",t.fillStyle=this._data.color,t.fillText(this._data.label,i+s,r/2)}_measureInfo(e,t,o){if(this._geomertryCacheInvalidated){const i=e.measureText(t),r=o,n=15,s=Math.round(r/1.3),a=i.width+2*n,l=r+2*s,d=(0,w.calcTextHorizontalShift)(e,i.width);this._geometryCache={paddingLeft:n,innerWidth:a,innerHeight:l,textHorizontalPadding:d},this._geomertryCacheInvalidated=!1}return this._geometryCache}}class V extends m.LineSourcePaneView{constructor(e,t){super(e,t),this._balloonRenderer=new N,this._renderer=null}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_updateImpl(e){super._updateImpl(e);const t=this._source.properties().childs(),o={points:this._points,color:t.color.value(),borderColor:t.borderColor.value(),backgroundColor:(0,_.generateColor)(t.backgroundColor.value(),t.transparency.value()),font:(0,y.makeFont)(t.fontsize.value(),b.CHART_FONT_FAMILY),fontSize:t.fontsize.value(),label:t.text.value()};if(this._balloonRenderer.setData(o),1===o.points.length){const e=new P.CompositeRenderer;return e.append(this._balloonRenderer),e.append(new v.SelectionRenderer({points:o.points.map(f.mapLineSourcePaneViewPointToLineAnchorPoint),bgColors:this._lineAnchorColors(o.points),visible:this.areAnchorsVisible(),barSpacing:this._model.timeScale().barSpacing(),hittestResult:T.HitTarget.MovePoint})),void(this._renderer=e)}
this._renderer=this._balloonRenderer}}const k=r.t(null,void 0,o(9818));class A extends s.InplaceTextLineDataSource{constructor(e,t,o,i){super(e,t??A.createProperties(e.backgroundTheme().spawnOwnership()),o,i),this._createPaneView()}pointsCount(){return 1}name(){return"Balloon"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}shouldBeRemovedOnDeselect(){return""===this._properties.childs().text.value().trim()}editableTextProperties(){(0,i.assert)(!1,"unexpected method call")}static createProperties(e,t){const o=new n.DefaultProperty({defaultName:"linetoolballoon",state:t,theme:e});return this._configureProperties(o),o}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}async _getPropertyDefinitionsViewModelClass(){return h}_createPaneView(){this._setPaneViews([new V(this,this._model)])}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new a.Property(this._defaultText)),e.addExcludedKey("text",1),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new l.LineToolColorsProperty([e.childs().color]))}}A._defaultText=k}}]);