"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9014],{67725:(e,t,i)=>{i.d(t,{createLineStyleDefinition:()=>S});var n=i(11542),r=i(95804),o=i(95338),s=i(91682);const a=new r.TranslatedString("change {toolName} line visibility",n.t(null,void 0,i(24550))),l=new r.TranslatedString("change {toolName} line width",n.t(null,void 0,i(19541))),d=new r.TranslatedString("change {toolName} line style",n.t(null,void 0,i(66429))),c=new r.TranslatedString("change {toolName} line color",n.t(null,void 0,i(24059))),h=new r.TranslatedString("change {toolName} line extending left",n.t(null,void 0,i(18773))),u=new r.TranslatedString("change {toolName} line left end",n.t(null,void 0,i(21474))),p=new r.TranslatedString("change {toolName} line extending right",n.t(null,void 0,i(43823))),_=new r.TranslatedString("change {toolName} line right end",n.t(null,void 0,i(54827))),g=n.t(null,void 0,i(3554)),P=n.t(null,void 0,i(61856)),f=n.t(null,void 0,i(87430));function S(e,t,i,n,r){const S={},x={id:`${(0,s.removeSpaces)(i.originalText())}${n}`,title:r&&r.line||g};return void 0!==t.showLine&&(S.checked=(0,o.convertToDefinitionProperty)(e,t.showLine,a.format({toolName:i}))),void 0!==t.lineWidth&&(S.width=(0,o.convertToDefinitionProperty)(e,t.lineWidth,l.format({toolName:i}))),void 0!==t.lineStyle&&(S.style=(0,o.convertToDefinitionProperty)(e,t.lineStyle,d.format({toolName:i}))),void 0!==t.lineColor&&(S.color=(0,o.getColorDefinitionProperty)(e,t.lineColor,null,c.format({toolName:i}))),void 0!==t.extendLeft&&(S.extendLeft=(0,o.convertToDefinitionProperty)(e,t.extendLeft,h.format({toolName:i})),x.extendLeftTitle=r&&r.extendLeftTitle||P),void 0!==t.leftEnd&&(S.leftEnd=(0,o.convertToDefinitionProperty)(e,t.leftEnd,u.format({toolName:i}))),void 0!==t.extendRight&&(S.extendRight=(0,o.convertToDefinitionProperty)(e,t.extendRight,p.format({toolName:i})),x.extendRightTitle=r&&r.extendRightTitle||f),void 0!==t.rightEnd&&(S.rightEnd=(0,o.convertToDefinitionProperty)(e,t.rightEnd,_.format({toolName:i}))),(0,o.createLinePropertyDefinition)(S,x)}},83138:(e,t,i)=>{i.r(t),i.d(t,{GeneralBezierDefinitionsViewModel:()=>u});var n=i(11542),r=i(95804),o=i(67725),s=i(14472),a=i(95338),l=i(91682);const d=new r.TranslatedString("change {title} background visibility",n.t(null,void 0,i(30839))),c=new r.TranslatedString("change {title} background color",n.t(null,void 0,i(49765))),h=n.t(null,void 0,i(79468));class u extends s.LineDataSourceDefinitionsViewModel{_stylePropertyDefinitions(){const e=this._source.properties().childs(),t=this._source.name(),i=new r.TranslatedString(t,this._source.translatedType());return{definitions:[(0,o.createLineStyleDefinition)(this._undoModel,{lineColor:e.linecolor,lineWidth:e.linewidth,lineStyle:e.linestyle,extendLeft:e.extendLeft,extendRight:e.extendRight,leftEnd:e.leftEnd,rightEnd:e.rightEnd},i,"Line"),(0,a.createColorPropertyDefinition)({checked:(0,a.convertToDefinitionProperty)(this._undoModel,e.fillBackground,d.format({title:i})),color:(0,
a.getColorDefinitionProperty)(this._undoModel,e.backgroundColor,e.transparency,c.format({title:i}))},{id:(0,l.removeSpaces)(`${t}BackgroundColor`),title:h})]}}}},14472:(e,t,i)=>{i.r(t),i.d(t,{LineDataSourceDefinitionsViewModel:()=>y,LineDataSourceTabTypes:()=>n,pointPriceBarTitle:()=>x});var n,r=i(50151),o=i(11542),s=i(95804),a=(i(40167),i(95338)),l=i(60567),d=i(22613),c=i(73863),h=i(97578),u=i(81634),p=i(36313);!function(e){e.Visibility="visibility",e.Coordinates="coordinates",e.Style="style",e.Text="text",e.Inputs="inputs"}(n||(n={}));const _=o.t(null,void 0,i(40091)),g=o.t(null,void 0,i(78930)),P=o.t(null,void 0,i(92516)),f=o.t(null,void 0,i(70320)),S=o.t(null,void 0,i(21429)),x=o.t(null,{context:"linetool point"},i(80166));class y{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 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,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 i=this._createTextPropertyPage();null!==i&&this._propertyPages.push(i);const n=this._createCoordinatesPropertyPage();null!==n&&(n.visible=this._source.hasEditableCoordinates(),this._propertyPages.push(n));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(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,l.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,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,i=[],n=this._getYCoordinateStepWV();return e.forEach(((e,r)=>{const o=t[r].childs();o&&i.push((0,h.getCoordinatesPropertiesDefinitions)(this._propertyApplier,o,e,n,x.format({count:(r+1).toString()}),this._source.name()))})),{definitions:i}}_createStylePropertyPage(){const e=this._stylePropertyDefinitions();return null!==e?(0,l.createPropertyPage)(e,"style",P):null}_stylePropertyDefinitions(){return null}_createTextPropertyPage(){const e=this._textPropertyDefinitions();return null!==e?(0,l.createPropertyPage)(e,"text",f):null}_textPropertyDefinitions(){return null}_createInputsPropertyPage(){const e=this._inputsPropertyDefinitions();return null!==e?(0,l.createPropertyPage)(e,"inputs",S):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)}}}},42318:(e,t,i)=>{i.r(t),i.d(t,{LineToolBezierCubic:()=>v});var n=i(50151),r=i(78176),o=i(41414),s=i(83138),a=i(52859),l=i(54707),d=i(20820),c=i(2383),h=i(33065),u=i(95998),p=i(80819),_=i(25672),g=i(78954),P=i(4539),f=i(58221);class S extends d.MediaCoordinatesPaneRenderer{constructor(e){super(),this._data=e||null}setData(e){this._data=e}hitTest(e){const t=this._data;if(null===t)return null;if(4===t.points.length){const i=(0,P.interactionTolerance)().curve,[n,r,o,s]=t.points,a=s.subtract(n),l=o.subtract(a.scaled(.25)),d=o.add(a.scaled(.25)),h=r.subtract(o),p=s.subtract(h.scaled(.25)),_=s.add(h.scaled(.25));if((0,u.quadroBezierHitTest)(o,n,l,e,i)||(0,u.cubicBezierHitTest)(o,d,p,s,e,i)||(0,u.quadroBezierHitTest)(s,r,_,e,i))return new c.HitTestResult(c.HitTarget.MovePoint);let f=(0,g.hitTestExtendedPoints)(e,i,t.extendLeftPoints);return null===f&&(f=(0,g.hitTestExtendedPoints)(e,i,t.extendRightPoints)),f}return null}_drawImpl(e){if(null===this._data)return;const t=e.context;t.lineCap="round",t.strokeStyle=this._data.color,t.lineWidth=this._data.lineWidth,(0,f.setLineStyle)(t,this._data.lineStyle);const i=this._data.points[0],n=this._data.points[1];if(2===this._data.points.length)t.beginPath(),t.moveTo(i.x,i.y),t.lineTo(n.x,n.y),t.stroke(),this._data.leftEnd===_.LineEnd.Arrow&&(0,p.drawArrow)(n,i,t,t.lineWidth,h.dpr1PixelRatioInfo),this._data.rightEnd===_.LineEnd.Arrow&&(0,p.drawArrow)(i,n,t,t.lineWidth,h.dpr1PixelRatioInfo);else{const e=this._data.points[2],r=this._data.points[3],o=r.subtract(i),s=e.subtract(o.scaled(.25)),a=e.add(o.scaled(.25)),l=n.subtract(e),d=r.subtract(l.scaled(.25)),c=r.add(l.scaled(.25));this._data.fillBack&&this._data.points.length>2&&(t.fillStyle=this._data.backColor,t.beginPath(),t.moveTo(i.x,i.y),t.quadraticCurveTo(s.x,s.y,e.x,e.y),
t.bezierCurveTo(a.x,a.y,d.x,d.y,r.x,r.y),t.quadraticCurveTo(c.x,c.y,n.x,n.y),t.fill()),t.beginPath(),(0,g.buildExtendedSegments)(t,this._data.extendLeftPoints),t.moveTo(i.x,i.y),t.quadraticCurveTo(s.x,s.y,e.x,e.y),t.bezierCurveTo(a.x,a.y,d.x,d.y,r.x,r.y),t.quadraticCurveTo(c.x,c.y,n.x,n.y),(0,g.buildExtendedSegments)(t,this._data.extendRightPoints),this._data.leftEnd===_.LineEnd.Arrow&&(0,p.drawArrow)(s,i,t,t.lineWidth,h.dpr1PixelRatioInfo),this._data.rightEnd===_.LineEnd.Arrow&&(0,p.drawArrow)(c,n,t,t.lineWidth,h.dpr1PixelRatioInfo),t.stroke()}}}var x=i(94602),y=i(63342);class m extends l.LineSourcePaneView{constructor(){super(...arguments),this._bezierCubicRenderer=new S,this._renderer=new x.CompositeRenderer,this._extendedSegmentLeftCache=null,this._extendedSegmentRightCache=null}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_updateImpl(e){if(super._updateImpl(e),this._renderer.clear(),this._points.length<2)return;const t=this._source.properties().childs();let i=[],r=[];if(4===this._source.points().length){const o=(0,n.ensureNotNull)(this._source.pointToScreenPoint(this._source.points()[0])),s=(0,n.ensureNotNull)(this._source.pointToScreenPoint(this._source.points()[1])),a=(0,n.ensureNotNull)(this._source.pointToScreenPoint(this._source.points()[2])),l=(0,n.ensureNotNull)(this._source.pointToScreenPoint(this._source.points()[3])),d=l.subtract(o),c=a.subtract(d.scaled(.25)),h=s.subtract(a),u=l.add(h.scaled(.25)),{mediaSize:{width:p,height:_}}=e;t.extendLeft.value()&&(i=this._extendSegmentLeft(a,o,c,p,_)),t.extendRight.value()&&(r=this._extendSegmentRight(l,s,u,p,_))}const o=this._points.slice(),s=this._source.controlPoints();null!==s&&(o.push((0,n.ensureNotNull)(this._source.pointToScreenPoint(s[0]))),o.push((0,n.ensureNotNull)(this._source.pointToScreenPoint(s[1]))));const l={points:o,color:t.linecolor.value(),lineWidth:t.linewidth.value(),lineStyle:t.linestyle.value(),leftEnd:t.leftEnd.value(),rightEnd:t.rightEnd.value(),fillBack:t.fillBackground.value(),backColor:(0,a.generateColor)(t.backgroundColor.value(),t.transparency.value()),extendLeftPoints:i,extendRightPoints:r};this._bezierCubicRenderer.setData(l),this._renderer.append(this._bezierCubicRenderer),this.addAnchors(this._renderer)}_extendSegmentLeft(e,t,i,r,o){return(0,y.cacheIsValid)(this._extendedSegmentLeftCache,e,t,i,r,o)||(this._extendedSegmentLeftCache={p1:e,p2:t,p3:i,width:r,height:o,segment:(0,u.extendQuadroBezier)(e,t,i,r,o)}),(0,n.ensureNotNull)(this._extendedSegmentLeftCache).segment}_extendSegmentRight(e,t,i,r,o){return(0,y.cacheIsValid)(this._extendedSegmentRightCache,e,t,i,r,o)||(this._extendedSegmentRightCache={p1:e,p2:t,p3:i,width:r,height:o,segment:(0,u.extendQuadroBezier)(e,t,i,r,o)}),(0,n.ensureNotNull)(this._extendedSegmentRightCache).segment}}class v extends o.LineDataSource{constructor(e,t,i,n){super(e,t??v.createProperties(e.backgroundTheme().spawnOwnership()),i,n),this._controlPoints=null,this._setPaneViews([new m(this,e)])}pointsCount(){return 2}name(){return"Double Curve"}normalizedPointsForCreating(){
const e=super.normalizedPointsForCreating();return[e[0],e[e.length-1]]}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this._controlPoints=this._calculateControlPoints(),i}addPoint(e,t,i){const n=super.addPoint(e,t,i);if(n){const e=this._calculateControlPoints(),t=this._model.mainSeries().interval();this._controlPoints=null,this._points.push({...e[0],interval:t}),this._points.push({...e[1],interval:t}),i||(this._normalizePoints(),this.createServerPoints()),this._createPointProperty(2),this._createPointProperty(3)}return n}restorePoints(e,t,i){super.restorePoints(e,t,i),this._createPointProperty(2),this._createPointProperty(3)}controlPoints(){return this._controlPoints}static createProperties(e,t){const i=new r.DefaultProperty({defaultName:"linetoolbeziercubic",state:t,theme:e});return this._configureProperties(i),i}async _getPropertyDefinitionsViewModelClass(){return s.GeneralBezierDefinitionsViewModel}_calculateControlPoints(){const e=(0,n.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),t=(0,n.ensureNotNull)(this.pointToScreenPoint(this.points()[1])),i=t.subtract(e).scaled(.5).transposed().scaled(.3),r=e.add(t).scaled(.33),o=e.add(t).scaled(.67),s=r.add(i),a=o.subtract(i);return[(0,n.ensureNotNull)(this.screenPointToPoint(s)),(0,n.ensureNotNull)(this.screenPointToPoint(a))]}}},63342:(e,t,i)=>{i.r(t),i.d(t,{BezierQuadroPaneView:()=>c,cacheIsValid:()=>d});var n=i(50151),r=i(52859),o=i(54707),s=i(94602),a=i(95998),l=i(78954);function d(e,t,i,n,r,o){return null!==e&&e.p1.x===t.x&&e.p1.y===t.y&&e.p2.x===i.x&&e.p2.y===i.y&&e.p3.x===n.x&&e.p3.y===n.y&&e.width===r&&e.height===o}class c extends o.LineSourcePaneView{constructor(){super(...arguments),this._bezierQuadroRenderer=new l.BezierQuadroRenderer,this._renderer=null,this._extendedSegmentLeftCache=null,this._extendedSegmentRightCache=null}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.properties().childs();let i=[],o=[];if(3===this._source.points().length){const r=(0,n.ensureNotNull)(this._source.pointToScreenPoint(this._source.points()[0])),s=(0,n.ensureNotNull)(this._source.pointToScreenPoint(this._source.points()[1])),a=(0,n.ensureNotNull)(this._source.pointToScreenPoint(this._source.points()[2])),l=s.subtract(r),d=a.subtract(l.scaled(.25)),c=a.add(l.scaled(.25)),{mediaSize:{width:h,height:u}}=e;t.extendLeft.value()&&(i=this._extendSegmentLeft(a,r,d,h,u)),t.extendRight.value()&&(o=this._extendSegmentRight(a,s,c,h,u))}const a=this._points.slice(),l=this._source.controlPoint();null!==l&&a.push((0,n.ensureNotNull)(this._source.pointToScreenPoint(l)));const d={points:a,color:t.linecolor.value(),lineWidth:t.linewidth.value(),lineStyle:t.linestyle.value(),leftEnd:t.leftEnd.value(),rightEnd:t.rightEnd.value(),fillBack:t.fillBackground.value(),backColor:(0,r.generateColor)(t.backgroundColor.value(),t.transparency.value()),extendLeftSegments:i,extendRightSegments:o};this._bezierQuadroRenderer.setData(d)
;const c=new s.CompositeRenderer;c.append(this._bezierQuadroRenderer),this.addAnchors(c),this._renderer=c}_extendSegmentLeft(e,t,i,r,o){return d(this._extendedSegmentLeftCache,e,t,i,r,o)||(this._extendedSegmentLeftCache={p1:e,p2:t,p3:i,width:r,height:o,segment:(0,a.extendQuadroBezier)(e,t,i,r,o)}),(0,n.ensureNotNull)(this._extendedSegmentLeftCache).segment}_extendSegmentRight(e,t,i,r,o){return d(this._extendedSegmentRightCache,e,t,i,r,o)||(this._extendedSegmentRightCache={p1:e,p2:t,p3:i,width:r,height:o,segment:(0,a.extendQuadroBezier)(e,t,i,r,o)}),(0,n.ensureNotNull)(this._extendedSegmentRightCache).segment}}},78954:(e,t,i)=>{i.d(t,{BezierQuadroRenderer:()=>_,buildExtendedSegments:()=>p,hitTestExtendedPoints:()=>u});var n=i(2624),r=i(20820),o=i(25672),s=i(2383),a=i(33065),l=i(95998),d=i(80819),c=i(4539),h=i(58221);function u(e,t,i){for(const r of i)for(let i=1;i<r.length;i++){const o=r[i-1],a=r[i];if((0,n.distanceToSegment)(o,a,e).distance<t)return new s.HitTestResult(s.HitTarget.MovePoint)}return null}function p(e,t){for(let i=0;i<t.length;i++){const n=t[i],r=n[0];e.moveTo(r.x,r.y);for(let t=1;t<n.length;t++){const i=n[t];e.lineTo(i.x,i.y)}}}class _ extends r.MediaCoordinatesPaneRenderer{constructor(e){super(),this._data=e||null}setData(e){this._data=e}hitTest(e){if(null!==this._data&&3===this._data.points.length){const t=(0,c.interactionTolerance)().curve,[i,n,r]=this._data.points,o=n.subtract(i),a=r.subtract(o.scaled(.25)),d=r.add(o.scaled(.25));if((0,l.quadroBezierHitTest)(r,i,a,e,t)||(0,l.quadroBezierHitTest)(r,n,d,e,t))return new s.HitTestResult(s.HitTarget.MovePoint);let h=u(e,t,this._data.extendLeftSegments);return null===h&&(h=u(e,t,this._data.extendRightSegments)),h}return null}_drawImpl(e){if(null===this._data)return;const[t,i,n]=this._data.points,r=e.context;if(r.lineCap="round",r.strokeStyle=this._data.color,r.lineWidth=this._data.lineWidth,(0,h.setLineStyle)(r,this._data.lineStyle),2===this._data.points.length)r.beginPath(),r.moveTo(t.x,t.y),r.lineTo(i.x,i.y),r.stroke();else{const e=i.subtract(t),s=n.subtract(e.scaled(.25)),l=n.add(e.scaled(.25));this._data.fillBack&&this._data.points.length>2&&(r.fillStyle=this._data.backColor,r.beginPath(),r.moveTo(t.x,t.y),r.quadraticCurveTo(s.x,s.y,n.x,n.y),r.quadraticCurveTo(l.x,l.y,i.x,i.y),r.fill()),r.beginPath(),p(r,this._data.extendLeftSegments),r.moveTo(t.x,t.y),r.quadraticCurveTo(s.x,s.y,n.x,n.y),r.quadraticCurveTo(l.x,l.y,i.x,i.y),p(r,this._data.extendRightSegments),this._data.leftEnd===o.LineEnd.Arrow&&(0,d.drawArrow)(s,t,r,r.lineWidth,a.dpr1PixelRatioInfo),this._data.rightEnd===o.LineEnd.Arrow&&(0,d.drawArrow)(l,i,r,r.lineWidth,a.dpr1PixelRatioInfo),r.stroke()}}}},54707:(e,t,i)=>{i.d(t,{LineSourcePaneView:()=>P,anchorResizeCursorType:()=>_,createLineSourcePaneViewPoint:()=>g});var n=i(58978),r=i(50151),o=i(39612),s=i(2383),a=i(45801),l=i(73914),d=i(43838),c=i(4753);const h=n.colorsPalette["color-tv-blue-600"];var u,p;function _(e,t){const i=e.x-t.x,n=e.y-t.y;if(!Number.isFinite(i)||!Number.isFinite(n)||0===i&&0===n)return d.PaneCursorType.Default
;let o=Math.atan2(n,i);return o<0&&(o+=2*Math.PI),o>=p.deg337_5||o<p.deg22_5||o>=p.deg157_5&&o<p.deg202_5?d.PaneCursorType.HorizontalResize:o>=p.deg22_5&&o<p.deg67_5||o>=p.deg202_5&&o<p.deg247_5?d.PaneCursorType.DiagonalNwSeResize:o>=p.deg67_5&&o<p.deg112_5||o>=p.deg247_5&&o<p.deg292_5?d.PaneCursorType.VerticalResize:o>=p.deg112_5&&o<p.deg157_5||o>=p.deg292_5&&o<p.deg337_5?d.PaneCursorType.DiagonalNeSwResize:void(0,r.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 P{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 n=null!==t?t.firstValue():null;return null===n?null:i.priceToCoordinate(e,n)}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 n=this._source.points(),r=i.map(((e,t)=>{const i=n[t],r=(0,l.lineSourcePaneViewPointToLineAnchorPoint)(e);return i&&(r.snappingPrice=i.price,r.snappingIndex=i.index),r}));e.append(this.createLineAnchor({...t,points:r},0))}createLineAnchor(e,t){const i=e.points.map((e=>e.point)),n=this._getOwnerSource();if(this.isLocked()){const r=this._getSelectionRenderer(t);return r.setData({bgColors:this._lineAnchorColors(i),points:e.points,visible:this.areAnchorsVisible(),hittestResult:s.HitTarget.Regular,ownerSourceId:n?.id(),barSpacing:this._model.timeScale().barSpacing()}),r}const r=(0,o.lastMouseOrTouchEventInfo)().isTouch,a=this._getLineAnchorRenderer(t),l=this.isHoveredSource()?this._model.lastHittestData()?.pointIndex??null:null;return a.setData({...e,color:this.anchorColor(),backgroundColors:this._lineAnchorColors(i),hoveredPointIndex:l,linePointBeingEdited:this.isBeingEdited()?this._model.linePointBeingEdited():null,
radius:this._anchorRadius(),strokeWidth:r?u.TouchStrokeWidth:u.RegularStrokeWidth,selected:this.isSelectedSource(),selectedStrokeWidth:r?u.TouchSelectedStrokeWidth:u.RegularSelectedStrokeWidth,visible:this.areAnchorsVisible(),clickHandler:e.clickHandler,ownerSourceId:n?.id()}),a}_getOwnerSource(){return this._ownerSource??this._source.ownerSource()}_anchorRadius(){return(0,o.lastMouseOrTouchEventInfo)().isTouch?u.TouchAnchorRadius:u.RegularAnchorRadius}_lineAnchorColors(e){const t=(0,r.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,t=this._source.properties().linecolor.value(),i){return null}_getSelectionRenderer(e){for(;this._selectionRenderers.length<=e;)this._selectionRenderers.push(new a.SelectionRenderer);return this._selectionRenderers[e]}_getLineAnchorRenderer(e){for(;this._lineAnchorRenderers.length<=e;)this._lineAnchorRenderers.push(new l.LineAnchorRenderer);return this._lineAnchorRenderers[e]}}},95998:(e,t,i)=>{i.d(t,{cubicBezierHitTest:()=>l,extendQuadroBezier:()=>d,quadroBezierHitTest:()=>s});var n,r=i(2624),o=i(77914);function s(e,t,i,n,o){const s=i.subtract(e).length()+i.subtract(t).length(),a=Math.max(3/s,.02);let l;for(let s=0;;s+=a){s>1&&(s=1);const a=e.scaled((1-s)*(1-s)),d=i.scaled(2*s*(1-s)),c=t.scaled(s*s),h=a.add(d).add(c);if(void 0!==l){if((0,r.distanceToSegment)(h,l,n).distance<o)return!0}else if(h.subtract(n).length()<o)return!0;if(l=h,1===s)break}return!1}function a(e,t,i,n,r){r=(0,o.clamp)(r,0,1);const s=e.scaled((1-r)*(1-r)*(1-r)),a=t.scaled(3*(1-r)*(1-r)*r),l=i.scaled(3*(1-r)*r*r),d=n.scaled(r*r*r);return s.add(a).add(l).add(d)}function l(e,t,i,n,o,s){const l=t.subtract(e).length()+i.subtract(t).length()+n.subtract(i).length(),d=Math.max(3/l,.02);let c;for(let l=0;;l+=d){const d=a(e,t,i,n,l);if(void 0!==c){if((0,r.distanceToSegment)(d,c,o).distance<s)return!0}else if(d.subtract(o).length()<s)return!0;if(c=d,l>=1)break}return!1}function d(e,t,i,n,r){const o=i.subtract(e).length()+i.subtract(t).length();if(!o)return[];const s=function(e,t,i,n,r){
const o=[],s=c(e.y,t.y,i.y,0).concat(c(e.y,t.y,i.y,r));for(let r=0;r<s.length;r++){const a=h(e.x,t.x,i.x,s[r]);a>=0&&a<=n&&o.push(s[r])}const a=c(e.x,t.x,i.x,0).concat(c(e.x,t.x,i.x,n));for(let n=0;n<a.length;n++){const s=h(e.y,t.y,i.y,a[n]);s>=0&&s<=r&&o.push(a[n])}return o}(e,t,i,n,r).filter((e=>e>1)).sort(((e,t)=>e-t));t.x>=0&&t.x<=n&&t.y>=0&&t.y<=r&&s.unshift(1);const a=3/o,l=[];for(let n=0;n<s.length-1;n+=2){let r=a,o=s[n],d=s[n+1]+r;const c=[];for(;o<=d;){const n=e.scaled((1-o)*(1-o)),s=i.scaled(2*o*(1-o)),a=t.scaled(o*o),l=n.add(s).add(a);if(c.length>0){c[c.length-1].subtract(l).length()<2&&(d+=r,r*=2)}c.push(l),o+=r}c.length>0&&l.push(c)}return l}function c(e,t,i,n){const r=[],o=e-2*i+t,s=2*i-2*e,a=e-n;if(Math.abs(o)>1e-8){const e=s*s-4*o*a;e>=0&&(r.push((-s+Math.sqrt(e))/(2*o)),r.push((-s-Math.sqrt(e))/(2*o)))}else r.push(-a/s);return r}function h(e,t,i,n){return(1-n)*(1-n)*e+2*(1-n)*n*i+n*n*t}!function(e){e[e.MaxHitTestSegments=50]="MaxHitTestSegments"}(n||(n={}))},73914:(e,t,i)=>{i.d(t,{LineAnchorRenderer:()=>f,lineSourcePaneViewPointToLineAnchorPoint:()=>S,lineSourcePaneViewPointToLineAnchorPoint2:()=>x,mapLineSourcePaneViewPointToLineAnchorPoint:()=>y});var n=i(10555),r=i(6453),o=i(50151),s=i(58221),a=i(87465),l=i(2383),d=i(43838),c=i(4539),h=i(10307);function u(e,t,i,n){const{point:r}=t,o=i+n/2;(0,s.drawRoundRect)(e,r.x-o,r.y-o,2*o,2*o,(i+n)/2),e.closePath(),e.lineWidth=n}function p(e,t,i,n){e.globalAlpha=.2,u(e,t,i,n),e.stroke(),e.globalAlpha=1}function _(e,t,i,n){u(e,t,i-n,n),e.fill(),e.stroke()}function g(e,t,i,n){const{point:r}=t;e.globalAlpha=.2,e.beginPath(),e.arc(r.x,r.y,i+n/2,0,2*Math.PI,!0),e.closePath(),e.lineWidth=n,e.stroke(),e.globalAlpha=1}function P(e,t,i,n){const{point:r}=t;e.beginPath(),e.arc(r.x,r.y,i-n/2,0,2*Math.PI,!0),e.closePath(),e.lineWidth=n,e.fill(),e.stroke()}class f 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,n=t+(0,c.interactionTolerance)().anchor;for(const t of i){if(t.point.subtract(e).length()<=n)return new l.HitTestResult(t.hitTarget??l.HitTarget.ChangePoint,{areaName:l.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,r.pointInBox)(t.point,e)))}_drawImpl(e){if(null===this._data||!this._data.visible)return;const t=[],i=[],n=[],r=[];for(let e=0;e<this._data.points.length;++e){const o=this._data.points[e],s=this._data.backgroundColors[e];o.square?(t.push(o),i.push(s)):(n.push(o),r.push(s))}t.length&&this._drawPoints(e,t,i,_,p),n.length&&this._drawPoints(e,n,r,P,g)}_drawPoints(e,t,i,r,s){
const{context:l,horizontalPixelRatio:d,verticalPixelRatio:c}=e,h=(0,o.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 P=_%2/2;l.strokeStyle=h.color;for(let e=0;e<t.length;++e){const o=t[e];if(!((0,a.isInteger)(o.pointIndex)&&h.linePointBeingEdited===o.pointIndex)){l.fillStyle=i[e];if(r(l,{...o,point:new n.Point(Math.round(o.point.x*d)+P,Math.round(o.point.y*c)+P)},g/2,p),!h.disableInteractions){if(null!==h.hoveredPointIndex&&o.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(l,{...o,point:new n.Point(Math.round(o.point.x*d)+P,Math.round(o.point.y*c)+P)},t/2,e)}}}}}}function S(e,t=e.pointIndex,i,n,r,o,s,a,l,d){return{point:e,pointIndex:t,cursorType:i,square:n,hitTarget:r,snappingPrice:o,snappingIndex:s,nonDiscreteIndex:a,activeItem:l,possibleMovingDirections:d}}function x(e){return S(e.point,e.pointIndex,e.cursorType,e.square,e.hitTarget,e.snappingPrice,e.snappingIndex,e.nonDiscreteIndex,e.activeItem,e.possibleMovingDirections)}function y(e){return S(e)}}}]);