Files
ai/charting_library/bundles/line-tool-abcd.a56dafade8fed1194ad0.js

10 lines
29 KiB
JavaScript

"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[6237],{72674:(e,t,i)=>{i.d(t,{createLineStyleDefinition:()=>v});var o=i(91599),n=i(72769),r=i(73405),s=i(42897);const l=new n.TranslatedString("change {toolName} line visibility",o.t(null,void 0,i(68915))),a=new n.TranslatedString("change {toolName} line width",o.t(null,void 0,i(16362))),d=new n.TranslatedString("change {toolName} line style",o.t(null,void 0,i(99523))),c=new n.TranslatedString("change {toolName} line color",o.t(null,void 0,i(66711))),h=new n.TranslatedString("change {toolName} line extending left",o.t(null,void 0,i(18067))),u=new n.TranslatedString("change {toolName} line left end",o.t(null,void 0,i(72185))),p=new n.TranslatedString("change {toolName} line extending right",o.t(null,void 0,i(38958))),_=new n.TranslatedString("change {toolName} line right end",o.t(null,void 0,i(51470))),g=o.t(null,void 0,i(27912)),f=o.t(null,void 0,i(32389)),m=o.t(null,void 0,i(74573));function v(e,t,i,o,n){const v={},b={id:`${(0,s.removeSpaces)(i.originalText())}${o}`,title:n&&n.line||g};return void 0!==t.showLine&&(v.checked=(0,r.convertToDefinitionProperty)(e,t.showLine,l.format({toolName:i}))),void 0!==t.lineWidth&&(v.width=(0,r.convertToDefinitionProperty)(e,t.lineWidth,a.format({toolName:i}))),void 0!==t.lineStyle&&(v.style=(0,r.convertToDefinitionProperty)(e,t.lineStyle,d.format({toolName:i}))),void 0!==t.lineColor&&(v.color=(0,r.getColorDefinitionProperty)(e,t.lineColor,null,c.format({toolName:i}))),void 0!==t.extendLeft&&(v.extendLeft=(0,r.convertToDefinitionProperty)(e,t.extendLeft,h.format({toolName:i})),b.extendLeftTitle=n&&n.extendLeftTitle||f),void 0!==t.leftEnd&&(v.leftEnd=(0,r.convertToDefinitionProperty)(e,t.leftEnd,u.format({toolName:i}))),void 0!==t.extendRight&&(v.extendRight=(0,r.convertToDefinitionProperty)(e,t.extendRight,p.format({toolName:i})),b.extendRightTitle=n&&n.extendRightTitle||m),void 0!==t.rightEnd&&(v.rightEnd=(0,r.convertToDefinitionProperty)(e,t.rightEnd,_.format({toolName:i}))),(0,r.createLinePropertyDefinition)(v,b)}},2171:(e,t,i)=>{i.d(t,{createTextStyleDefinition:()=>D});var o=i(91599),n=i(72769),r=i(73405),s=i(42897)
;const l=new n.TranslatedString("change {toolName} text visibility",o.t(null,void 0,i(67684))),a=new n.TranslatedString("change {toolName} text color",o.t(null,void 0,i(65304))),d=new n.TranslatedString("change {toolName} text font size",o.t(null,void 0,i(70052))),c=new n.TranslatedString("change {toolName} text font bold",o.t(null,void 0,i(75446))),h=new n.TranslatedString("change {toolName} text font italic",o.t(null,void 0,i(63944))),u=new n.TranslatedString("change {toolName} text",o.t(null,void 0,i(40382))),p=new n.TranslatedString("change {toolName} labels alignment vertical",o.t(null,void 0,i(28579))),_=new n.TranslatedString("change {toolName} labels alignment horizontal",o.t(null,void 0,i(81746))),g=new n.TranslatedString("change {toolName} labels direction",o.t(null,void 0,i(10377))),f=new n.TranslatedString("change {toolName} text background visibility",o.t(null,void 0,i(31397))),m=new n.TranslatedString("change {toolName} text background color",o.t(null,void 0,i(28838))),v=new n.TranslatedString("change {toolName} text border visibility",o.t(null,void 0,i(12379))),b=new n.TranslatedString("change {toolName} text border width",o.t(null,void 0,i(81802))),y=new n.TranslatedString("change {toolName} text border color",o.t(null,void 0,i(22174))),P=new n.TranslatedString("change {toolName} text wrap",o.t(null,void 0,i(55044))),T=o.t(null,void 0,i(36926)),S=o.t(null,void 0,i(69407)),w=o.t(null,void 0,i(41697)),x=o.t(null,void 0,i(3443));function D(e,t,i,o){const n={},D={id:`${(0,s.removeSpaces)(i.originalText())}Text`,title:o.customTitles&&o.customTitles.text||"",placeholder:o.placeholder??x};if(void 0===t.showText||o.hideTextCheckbox||(n.checked=(0,r.convertToDefinitionProperty)(e,t.showText,l.format({toolName:i}))),void 0!==t.textColor&&(n.color=(0,r.getColorDefinitionProperty)(e,t.textColor,t.transparency||null,a.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,h.format({toolName:i}))),void 0!==t.text){const s=u.format({toolName:i});n.text=(0,r.convertToDefinitionProperty)(e,t.text,s,void 0),D.isEditable=Boolean(o.isEditable),D.isMultiLine=Boolean(o.isMultiLine)}if(void 0!==t.vertLabelsAlign&&(n.alignmentVertical=(0,r.convertToDefinitionProperty)(e,t.vertLabelsAlign,p.format({toolName:i})),D.alignmentVerticalItems=o.alignmentVerticalItems),void 0!==t.horzLabelsAlign&&(n.alignmentHorizontal=(0,r.convertToDefinitionProperty)(e,t.horzLabelsAlign,_.format({toolName:i})),D.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,f.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,m.format({toolName:i}))}return void 0===t.backgroundVisible&&void 0===t.backgroundColor||(D.backgroundTitle=o.customTitles&&o.customTitles.backgroundTitle||T),void 0!==t.borderVisible&&(n.borderVisible=(0,r.convertToDefinitionProperty)(e,t.borderVisible,v.format({toolName:i}))),void 0!==t.borderWidth&&(n.borderWidth=(0,r.convertToDefinitionProperty)(e,t.borderWidth,b.format({toolName:i}))),void 0!==t.borderColor&&(n.borderColor=(0,r.getColorDefinitionProperty)(e,t.borderColor,null,y.format({toolName:i}))),void 0===t.borderVisible&&void 0===t.borderColor&&void 0===t.borderWidth||(D.borderTitle=o.customTitles&&o.customTitles.borderTitle||S),void 0!==t.wrap&&(n.wrap=(0,r.convertToDefinitionProperty)(e,t.wrap,P.format({toolName:i})),D.wrapTitle=o.customTitles&&o.customTitles.wrapTitle||w),(0,r.createTextPropertyDefinition)(n,D)}},44907:(e,t,i)=>{i.r(t),i.d(t,{LineDataSourceDefinitionsViewModel:()=>y,LineDataSourceTabTypes:()=>o,pointPriceBarTitle:()=>b});var o,n=i(85842),r=i(91599),s=i(72769),l=(i(53225),i(73405)),a=i(18632),d=i(89659),c=i(5258),h=i(14405),u=i(78379),p=i(65366);!function(e){e.Visibility="visibility",e.Coordinates="coordinates",e.Style="style",e.Text="text",e.Inputs="inputs"}(o||(o={}));const _=r.t(null,void 0,i(87733)),g=r.t(null,void 0,i(18817)),f=r.t(null,void 0,i(31992)),m=r.t(null,void 0,i(79115)),v=r.t(null,void 0,i(2931)),b=r.t(null,{context:"linetool point"},i(59712));class y{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 u.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 o=this._createCoordinatesPropertyPage();null!==o&&(o.visible=this._source.hasEditableCoordinates(),this._propertyPages.push(o));const n=this._createVisibilitiesPropertyPage();this._propertyPages.push(n)}_createVisibilitiesPropertyPage(){const e=this._source.properties().childs().intervalsVisibilities.childs();return(0,a.createPropertyPage)((0,c.getIntervalsVisibilitiesPropertiesDefinitions)(this._propertyApplier,e,new s.TranslatedString(this._source.name(),this._source.title(p.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",g)):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,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=[],o=this._getYCoordinateStepWV();return e.forEach(((e,n)=>{const r=t[n].childs();r&&i.push((0,h.getCoordinatesPropertiesDefinitions)(this._propertyApplier,r,e,o,b.format({count:(n+1).toString()}),this._source.name()))})),{definitions:i}}_createStylePropertyPage(){const e=this._stylePropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"style",f):null}_stylePropertyDefinitions(){return null}_createTextPropertyPage(){const e=this._textPropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"text",m):null}_textPropertyDefinitions(){return null}_createInputsPropertyPage(){const e=this._inputsPropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"inputs",v):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)}}}},33458:(e,t,i)=>{i.r(t),i.d(t,{PatternWithoutBackgroundDefinitionsViewModel:()=>c});var o=i(91599),n=i(72769),r=i(72674),s=i(2171),l=i(44907);const a=o.t(null,void 0,i(78011)),d=o.t(null,void 0,i(69407));class c extends l.LineDataSourceDefinitionsViewModel{_stylePropertyDefinitions(){const e=this._source.properties().childs(),t=new n.TranslatedString(this._source.name(),this._source.translatedType());return{definitions:[(0,s.createTextStyleDefinition)(this._propertyApplier,{textColor:e.textcolor,fontSize:e.fontsize,bold:e.bold,italic:e.italic},t,{isEditable:!0,isMultiLine:!0,customTitles:{text:a}}),(0,r.createLineStyleDefinition)(this._propertyApplier,{lineColor:e.color,lineWidth:e.linewidth},t,"Line",{line:d})]}}}},45626:(e,t,i)=>{i.r(t),i.d(t,{LineToolABCD:()=>W});var o=i(33458),n=i(82014),r=i(85842),s=i(47097),l=i(86684),a=i(17567),d=i(93445),c=i(88483),h=i(5829),u=i(25432),p=i(86371),_=i(33993);const g={intervalsVisibilities:{...c.intervalsVisibilitiesDefaults},
linewidth:h.DEFAULT_LINE_TOOL_LINE_WIDTH,fontsize:12,bold:!1,italic:!1},f={color:l.colors.colorMintyGreen500,textcolor:l.colors.colorWhite},m=new Map([[s.StdTheme.Light,f],[s.StdTheme.Dark,f]]),v=(0,d.extractThemedColors)((0,r.ensureDefined)(m.get(s.StdTheme.Light)),(0,r.ensureDefined)(m.get(s.StdTheme.Dark))),b=(0,d.extractAllPropertiesKeys)((0,r.ensureDefined)(m.get(s.StdTheme.Light))),y=(0,d.extractAllPropertiesKeys)(g),P=[...b,...y],T=[...new Set([...P,...u.commonLineToolPropertiesStateKeys])];class S extends p.LineDataSourceProperty{constructor(e){super(e),this.addChild("linesColors",new _.LineToolColorsProperty([this.childs().color])),this.addChild("textsColors",new _.LineToolColorsProperty([this.childs().textcolor]))}static create(e,t){return new this({defaultName:"linetoolabcd",factoryDefaultsSupplier:()=>(0,a.factoryDefaultsForCurrentTheme)(g,m),nonThemedDefaultsKeys:y,themedDefaultsKeys:b,allStateKeys:T,themedColors:v,templateKeys:P,replaceThemedColorsOnThemeChange:!0,state:t,theme:e})}}var w=i(95385),x=i(80140),D=i(99680),A=i(34192),R=i(6353),C=i(61208),L=i(68459),I=i(5915),k=i(83077),V=i(41928),N=i(14491);class M extends V.LineSourcePaneView{constructor(){super(...arguments),this._abRetracementTrend=new R.TrendLineRenderer,this._cdRetracementTrend=new R.TrendLineRenderer,this._polylineRenderer=new I.PolygonRenderer(new k.HitTestResult(k.HitTarget.MovePoint)),this._abLabelRenderer=new C.TextRenderer,this._cdLabelRenderer=new C.TextRenderer,this._textRendererALabel=new C.TextRenderer,this._textRendererBLabel=new C.TextRenderer,this._textRendererCLabel=new C.TextRenderer,this._textRendererDLabel=new C.TextRenderer,this._renderer=null}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_updateImpl(e){if(super._updateImpl(e),this._points.length<2)return void(this._renderer=null);const t=this._source.properties().childs(),i=new D.CompositeRenderer,o=(e,i)=>({points:[e],text:i,color:t.textcolor.value(),vertAlign:w.VerticalAlign.Middle,horzAlign:w.HorizontalAlign.Center,font:N.CHART_FONT_FAMILY,offsetX:0,offsetY:0,bold:t.bold&&t.bold.value(),italic:t.italic&&t.italic.value(),fontsize:t.fontsize.value(),backgroundColor:t.color.value(),backgroundRoundRect:4}),n=(e,i)=>({points:[e,i],color:t.color.value(),linewidth:t.linewidth.value(),linestyle:x.LINESTYLE_DOTTED,extendleft:!1,extendright:!1,leftend:L.LineEnd.Normal,rightend:L.LineEnd.Normal}),[r,s,l,a]=this._points,d={points:this._points,color:t.color.value(),linewidth:t.linewidth.value(),linestyle:x.LINESTYLE_SOLID,fillBackground:!1,filled:!1,backcolor:"rgba(0, 0, 0, 0)"};this._polylineRenderer.setData(d),i.append(this._polylineRenderer);const c=o(r,"A");s.y>r.y?(c.vertAlign=w.VerticalAlign.Bottom,c.offsetY=5):(c.vertAlign=w.VerticalAlign.Top,c.offsetY=5),this._textRendererALabel.setData(c),i.append(this._textRendererALabel);const h=o(s,"B");if(s.y<r.y?(h.vertAlign=w.VerticalAlign.Bottom,h.offsetY=5):(h.vertAlign=w.VerticalAlign.Top,h.offsetY=5),this._textRendererBLabel.setData(h),i.append(this._textRendererBLabel),this._points.length>2){
const e=o(l,"C");l.y<s.y?(e.vertAlign=w.VerticalAlign.Bottom,e.offsetY=5):(e.vertAlign=w.VerticalAlign.Top,e.offsetY=5),this._textRendererCLabel.setData(e),i.append(this._textRendererCLabel)}if(this._points.length>3){const e=o(a,"D");a.y<l.y?(e.vertAlign=w.VerticalAlign.Bottom,e.offsetY=5):(e.vertAlign=w.VerticalAlign.Top,e.offsetY=5),this._textRendererDLabel.setData(e),i.append(this._textRendererDLabel)}const u=(0,A.getNumericFormatter)();if(this._points.length>=3){this._abRetracementTrend.setData(n(r,l)),i.append(this._abRetracementTrend);const e=r.add(l).scaled(.5),[t,s,a]=this._source.points(),d=Math.round(1e3*Math.abs((a.price-s.price)/(s.price-t.price)))/1e3,c=o(e,u.format(d));this._abLabelRenderer.setData(c),i.append(this._abLabelRenderer)}if(this._points.length>=4){this._cdRetracementTrend.setData(n(s,a)),i.append(this._cdRetracementTrend);const e=s.add(a).scaled(.5),[,t,r,l]=this._source.points(),d=Math.round(1e3*Math.abs((l.price-r.price)/(r.price-t.price)))/1e3,c=o(e,u.format(d));this._cdLabelRenderer.setData(c),i.append(this._cdLabelRenderer)}this.addAnchors(i),this._renderer=i}}class W extends n.LineDataSource{constructor(e,t,i,o){super(e,t??W.createProperties(e.backgroundTheme().spawnOwnership()),i,o),this._setPaneViews([new M(this,e)])}pointsCount(){return 4}name(){return"ABCD Pattern"}static createProperties(e,t){const i=S.create(e,t);return this._configureProperties(i),i}async _getPropertyDefinitionsViewModelClass(){return o.PatternWithoutBackgroundDefinitionsViewModel}}},25432:(e,t,i)=>{i.d(t,{commonLineToolPropertiesStateKeys:()=>o});const o=["symbolStateVersion","zOrderVersion","frozen","title","interval","symbol","currencyId","unitId","metricId","visible","adjustedToSplitTime","intervalsVisibilities.ticks","intervalsVisibilities.seconds","intervalsVisibilities.secondsFrom","intervalsVisibilities.secondsTo","intervalsVisibilities.minutes","intervalsVisibilities.minutesFrom","intervalsVisibilities.minutesTo","intervalsVisibilities.hours","intervalsVisibilities.hoursFrom","intervalsVisibilities.hoursTo","intervalsVisibilities.days","intervalsVisibilities.daysFrom","intervalsVisibilities.daysTo","intervalsVisibilities.weeks","intervalsVisibilities.weeksFrom","intervalsVisibilities.weeksTo","intervalsVisibilities.months","intervalsVisibilities.monthsFrom","intervalsVisibilities.monthsTo","intervalsVisibilities.ranges"];var n,r,s;!function(e){e[e.NotShared=0]="NotShared",e[e.SharedInLayout=1]="SharedInLayout",e[e.GloballyShared=2]="GloballyShared"}(n||(n={})),function(e){e.BeforeAllAction="BeforeAll",e.CustomAction="CustomAction"}(r||(r={})),function(e){e.FloatingToolbarButton="FloatingToolbarButton",e.Default="Default"}(s||(s={}))},41928:(e,t,i)=>{i.d(t,{LineSourcePaneView:()=>f,anchorResizeCursorType:()=>_,createLineSourcePaneViewPoint:()=>g});var o=i(11284),n=i(85842),r=i(29968),s=i(83077),l=i(71367),a=i(8165),d=i(28031),c=i(61208);const h=o.colorsPalette["color-tv-blue-600"];var u,p;function _(e,t){const i=e.x-t.x,o=e.y-t.y
;if(!Number.isFinite(i)||!Number.isFinite(o)||0===i&&0===o)return d.PaneCursorType.Default;let r=Math.atan2(o,i);return r<0&&(r+=2*Math.PI),r>=p.deg337_5||r<p.deg22_5||r>=p.deg157_5&&r<p.deg202_5?d.PaneCursorType.HorizontalResize:r>=p.deg22_5&&r<p.deg67_5||r>=p.deg202_5&&r<p.deg247_5?d.PaneCursorType.DiagonalNwSeResize:r>=p.deg67_5&&r<p.deg112_5||r>=p.deg247_5&&r<p.deg292_5?d.PaneCursorType.VerticalResize:r>=p.deg112_5&&r<p.deg157_5||r>=p.deg292_5&&r<p.deg337_5?d.PaneCursorType.DiagonalNeSwResize:void(0,n.assert)(!1,"unexpected angle")}function g(e,t){return e.pointIndex=t,e}!function(e){e[e.RegularAnchorRadius=6]="RegularAnchorRadius",e[e.TouchAnchorRadius=13]="TouchAnchorRadius",e[e.RegularStrokeWidth=1]="RegularStrokeWidth",e[e.TouchStrokeWidth=3]="TouchStrokeWidth",e[e.RegularSelectedStrokeWidth=3]="RegularSelectedStrokeWidth",e[e.TouchSelectedStrokeWidth=0]="TouchSelectedStrokeWidth"}(u||(u={})),function(e){e[e.deg22_5=Math.PI/8]="deg22_5",e[e.deg67_5=3*Math.PI/8]="deg67_5",e[e.deg112_5=5*Math.PI/8]="deg112_5",e[e.deg157_5=7*Math.PI/8]="deg157_5",e[e.deg202_5=9*Math.PI/8]="deg202_5",e[e.deg247_5=11*Math.PI/8]="deg247_5",e[e.deg292_5=13*Math.PI/8]="deg292_5",e[e.deg337_5=15*Math.PI/8]="deg337_5"}(p||(p={}));class f{constructor(e,t,i){this._invalidated=!0,this._points=[],this._middlePoint=null,this._selectionRenderers=[],this._lineAnchorRenderers=[],this._source=e,this._model=t,this._ownerSource=i??null}priceToCoordinate(e){const t=this._getOwnerSource(),i=t?.priceScale();if(null==i)return null;const o=null!==t?t.firstValue():null;return null===o?null:i.priceToCoordinate(e,o)}anchorColor(){return h}isHoveredSource(){return this._source===this._model.hoveredSource()}isSelectedSource(){return this._model.selection().isSelected(this._source)}isBeingEdited(){return this._model.lineBeingEdited()===this._source}isEditMode(){return!this._model.isSnapshot()}areAnchorsVisible(){return(this.isHoveredSource()&&!this.isLocked()||this.isSelectedSource())&&this.isEditMode()}update(){this._invalidated=!0}isLocked(){return Boolean(this._source.isLocked&&this._source.isLocked())}addAnchors(e,t={}){let i=this._getPoints();this._model.lineBeingCreated()===this._source&&(i=i.slice(0,-1));const o=this._source.points(),n=i.map(((e,t)=>{const i=o[t],n=(0,a.lineSourcePaneViewPointToLineAnchorPoint)(e);return i&&(n.snappingPrice=i.price,n.snappingIndex=i.index),n}));e.append(this.createLineAnchor({...t,points:n},0))}createLineAnchor(e,t){const i=e.points.map((e=>e.point)),o=this._getOwnerSource();if(this.isLocked()){const n=this._getSelectionRenderer(t);return n.setData({bgColors:this._lineAnchorColors(i),points:e.points,visible:this.areAnchorsVisible(),hittestResult:s.HitTarget.Regular,ownerSourceId:o?.id(),barSpacing:this._model.timeScale().barSpacing()}),n}const n=(0,r.lastMouseOrTouchEventInfo)().isTouch,l=this._getLineAnchorRenderer(t),a=this.isHoveredSource()?this._model.lastHittestData()?.pointIndex??null:null;return l.setData({...e,color:this.anchorColor(),backgroundColors:this._lineAnchorColors(i),hoveredPointIndex:a,
linePointBeingEdited:this.isBeingEdited()?this._model.linePointBeingEdited():null,radius:this._anchorRadius(),strokeWidth:n?u.TouchStrokeWidth:u.RegularStrokeWidth,selected:this.isSelectedSource(),selectedStrokeWidth:n?u.TouchSelectedStrokeWidth:u.RegularSelectedStrokeWidth,visible:this.areAnchorsVisible(),clickHandler:e.clickHandler,ownerSourceId:o?.id()}),l}_getOwnerSource(){return this._ownerSource??this._source.ownerSource()}_anchorRadius(){return(0,r.lastMouseOrTouchEventInfo)().isTouch?u.TouchAnchorRadius:u.RegularAnchorRadius}_lineAnchorColors(e){const t=(0,n.ensureNotNull)(this._model.paneForSource(this._source)).height();return e.map((e=>this._model.backgroundColorAtYPercentFromTop(e.y/t)))}_updateImpl(e){this._points=[];this._model.timeScale().isEmpty()||this._validatePriceScale()&&(this._source.points().forEach(((e,t)=>{const i=this._source.pointToScreenPoint(e,this._ownerSource??void 0);i&&this._points.push(g(i,t))})),2===this._points.length&&(this._middlePoint=this._source.calcMiddlePoint(this._points[0],this._points[1])),this._invalidated=!1)}_validatePriceScale(){const e=this._getOwnerSource()?.priceScale();return null!=e&&!e.isEmpty()}_getSource(){return this._source}_getPoints(){return this._points}_getModel(){return this._model}_height(){const e=this._getOwnerSource()?.priceScale();return null!=e?e.height():0}_width(){return this._model.timeScale().width()}_needLabelExclusionPath(e,t){const i=this._source.properties().childs();return"middle"===(t??i.vertLabelsAlign.value())&&(0,c.needTextExclusionPath)(e)}_addAlertRenderer(e,t,i=this._source.properties().linecolor.value()){}_getAlertRenderer(e){return null}_getSelectionRenderer(e){for(;this._selectionRenderers.length<=e;)this._selectionRenderers.push(new l.SelectionRenderer);return this._selectionRenderers[e]}_getLineAnchorRenderer(e){for(;this._lineAnchorRenderers.length<=e;)this._lineAnchorRenderers.push(new a.LineAnchorRenderer);return this._lineAnchorRenderers[e]}}},86371:(e,t,i)=>{i.d(t,{LineDataSourceProperty:()=>a});var o=i(57600),n=i(35558),r=i(85842),s=i(93445),l=i(47895);class a extends s.DefaultProperty{constructor({templateKeys:e,factoryDefaultsSupplier:t,...i}){let o=t;t&&(o=()=>{const e=t();return(0,l.applyDefaultsOverrides)(e,void 0,void 0,i.defaultName),e}),super({saveNonDefaultUserPreferencesOnly:!0,factoryDefaultsSupplier:o,...i}),this._templateKeys=(0,r.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,s.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,s.extractState)((0,n.default)((0,o.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},8165:(e,t,i)=>{i.d(t,{LineAnchorRenderer:()=>m,lineSourcePaneViewPointToLineAnchorPoint:()=>v,lineSourcePaneViewPointToLineAnchorPoint2:()=>b,mapLineSourcePaneViewPointToLineAnchorPoint:()=>y});var o=i(57415),n=i(91069),r=i(85842),s=i(51946),l=i(7321),a=i(83077),d=i(28031),c=i(72244),h=i(57507);function u(e,t,i,o){const{point:n}=t,r=i+o/2;(0,s.drawRoundRect)(e,n.x-r,n.y-r,2*r,2*r,(i+o)/2),e.closePath(),e.lineWidth=o}
function p(e,t,i,o){e.globalAlpha=.2,u(e,t,i,o),e.stroke(),e.globalAlpha=1}function _(e,t,i,o){u(e,t,i-o,o),e.fill(),e.stroke()}function g(e,t,i,o){const{point:n}=t;e.globalAlpha=.2,e.beginPath(),e.arc(n.x,n.y,i+o/2,0,2*Math.PI,!0),e.closePath(),e.lineWidth=o,e.stroke(),e.globalAlpha=1}function f(e,t,i,o){const{point:n}=t;e.beginPath(),e.arc(n.x,n.y,i-o/2,0,2*Math.PI,!0),e.closePath(),e.lineWidth=o,e.fill(),e.stroke()}class m extends h.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e??null}setData(e){this._data=e}hitTest(e){if(null===this._data||this._data.disableInteractions)return null;const{radius:t,points:i}=this._data,o=t+(0,c.interactionTolerance)().anchor;for(const t of i){if(t.point.subtract(e).length()<=o)return new a.HitTestResult(t.hitTarget??a.HitTarget.ChangePoint,{areaName:a.AreaName.AnchorPoint,pointIndex:t.pointIndex,cursorType:t.cursorType??d.PaneCursorType.Default,activeItem:t.activeItem,snappingPrice:t.snappingPrice,snappingIndex:t.snappingIndex,nonDiscreteIndex:t.nonDiscreteIndex,possibleMovingDirections:t.possibleMovingDirections,clickHandler:this._data.clickHandler,tapHandler:this._data.clickHandler,ownerSourceId:this._data.ownerSourceId})}return null}doesIntersectWithBox(e){return null!==this._data&&this._data.points.some((t=>(0,n.pointInBox)(t.point,e)))}_drawImpl(e){if(null===this._data||!this._data.visible)return;const t=[],i=[],o=[],n=[];for(let e=0;e<this._data.points.length;++e){const r=this._data.points[e],s=this._data.backgroundColors[e];r.square?(t.push(r),i.push(s)):(o.push(r),n.push(s))}t.length&&this._drawPoints(e,t,i,_,p),o.length&&this._drawPoints(e,o,n,f,g)}_drawPoints(e,t,i,n,s){const{context:a,horizontalPixelRatio:d,verticalPixelRatio:c}=e,h=(0,r.ensureNotNull)(this._data),u=h.radius;let p=Math.max(1,Math.floor((h.strokeWidth||2)*d));h.selected&&(p+=Math.max(1,Math.floor(d/2)));const _=Math.max(1,Math.floor(d));let g=Math.round(u*d*2);g%2!=_%2&&(g+=1);const f=_%2/2;a.strokeStyle=h.color;for(let e=0;e<t.length;++e){const r=t[e];if(!((0,l.isInteger)(r.pointIndex)&&h.linePointBeingEdited===r.pointIndex)){a.fillStyle=i[e];if(n(a,{...r,point:new o.Point(Math.round(r.point.x*d)+f,Math.round(r.point.y*c)+f)},g/2,p),!h.disableInteractions){if(null!==h.hoveredPointIndex&&r.pointIndex===h.hoveredPointIndex){const e=Math.max(1,Math.floor(h.selectedStrokeWidth*d));let t=Math.round(u*d*2);t%2!=_%2&&(t+=1);s(a,{...r,point:new o.Point(Math.round(r.point.x*d)+f,Math.round(r.point.y*c)+f)},t/2,e)}}}}}}function v(e,t=e.pointIndex,i,o,n,r,s,l,a,d){return{point:e,pointIndex:t,cursorType:i,square:o,hitTarget:n,snappingPrice:r,snappingIndex:s,nonDiscreteIndex:l,activeItem:a,possibleMovingDirections:d}}function b(e){return v(e.point,e.pointIndex,e.cursorType,e.square,e.hitTarget,e.snappingPrice,e.snappingIndex,e.nonDiscreteIndex,e.activeItem,e.possibleMovingDirections)}function y(e){return v(e)}},5915:(e,t,i)=>{i.d(t,{PolygonRenderer:()=>_});var o=i(91069),n=i(17086),r=i(6353),s=i(68459),l=i(83077),a=i(82347),d=i(56568),c=i(72244),h=i(51946),u=i(80140),p=i(40450)
;class _ extends d.MediaCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._backHittest=new l.HitTestResult(l.HitTarget.MovePointBackground),this._points=[],this._hittest=e??new l.HitTestResult(l.HitTarget.MovePoint)}setData(e){this._data=e,this._points=e.points}hitTest(e){if(null===this._data||this._data.disableInteractions)return null;const t=Math.max((0,c.interactionTolerance)().line,Math.ceil(this._data.linewidth/2)),i=this._points.length;if(1===i){return(0,o.pointInCircle)(e,this._points[0],t)?this._hittest:null}for(let o=1;o<i;o++){const i=this._points[o-1],r=this._points[o];if((0,n.distanceToSegment)(i,r,e).distance<=t)return this._hittest}if(this._data.filled&&this._data.fillBackground&&i>0){const o=this._points[0],r=this._points[i-1];if((0,n.distanceToSegment)(o,r,e).distance<=t)return this._hittest}return this._data.filled&&this._data.fillBackground&&(0,o.pointInPolygon)(e,this._data.points)?this._backHittest:null}_drawImpl(e){const t=e.context,i=this._points.length;if(null===this._data||0===i)return;const o=t.globalAlpha;try{if(void 0!==this._data.globalAlpha&&(t.globalAlpha=this._data.globalAlpha),1===i)return void this._drawPoint(t,this._points[0],this._data.linewidth/2,this._data.color);t.beginPath();const e=this._data.linestyle===u.LINESTYLE_SOLID?"round":"butt",o=this._data.linecap??e;t.lineCap=o,t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineJoin=this._data.linejoin??"round",(0,h.setLineStyle)(t,this._data.linestyle);const n=this._points[0];t.moveTo(n.x,n.y);for(const e of this._points)t.lineTo(e.x,e.y);if(this._data.filled&&this._data.fillBackground&&(t.fillStyle=(0,a.generateColor)(this._data.backcolor,this._data.transparency),t.fill()),this._data.filled&&!this._data.skipClosePath&&t.closePath(),i>1){if(this._data.leftend===s.LineEnd.Arrow){const e=this._correctArrowPoints(this._points[1],this._points[0],t.lineWidth,o);(0,r.drawArrow)(e[0],e[1],t,t.lineWidth,p.dpr1PixelRatioInfo)}if(this._data.rightend===s.LineEnd.Arrow){const e=this._correctArrowPoints(this._points[i-2],this._points[i-1],t.lineWidth,o);(0,r.drawArrow)(e[0],e[1],t,t.lineWidth,p.dpr1PixelRatioInfo)}}this._data.linewidth>0&&t.stroke()}finally{t.globalAlpha=o}}_drawPoint(e,t,i,o){0!==i&&(e.beginPath(),e.fillStyle=o,e.arc(t.x,t.y,i,0,2*Math.PI,!0),e.fill(),e.closePath())}_correctArrowPoints(e,t,i,o){const n=t.subtract(e),r=n.length();if("butt"===o||r<1)return[e,t];const s=r+i/2;return[e,n.scaled(s/r).add(e)]}}},17567:(e,t,i)=>{i.d(t,{factoryDefaultsForCurrentTheme:()=>a});var o=i(35558),n=i(57600),r=i(85842),s=i(49841),l=i(47097);function a(e,t){const i=s.watchedTheme.value()??l.StdTheme.Light,a=(0,n.default)(e);return(0,o.default)(a,(0,r.ensureDefined)(t.get(i))),a}}}]);