"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[1977],{25432:(e,t,i)=>{i.d(t,{commonLineToolPropertiesStateKeys:()=>n});const n=["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 r,o,s;!function(e){e[e.NotShared=0]="NotShared",e[e.SharedInLayout=1]="SharedInLayout",e[e.GloballyShared=2]="GloballyShared"}(r||(r={})),function(e){e.BeforeAllAction="BeforeAll",e.CustomAction="CustomAction"}(o||(o={})),function(e){e.FloatingToolbarButton="FloatingToolbarButton",e.Default="Default"}(s||(s={}))},41928:(e,t,i)=>{i.d(t,{LineSourcePaneView:()=>y,anchorResizeCursorType:()=>g,createLineSourcePaneViewPoint:()=>_});var n=i(11284),r=i(85842),o=i(29968),s=i(83077),a=i(71367),l=i(8165),h=i(28031),d=i(61208);const c=n.colorsPalette["color-tv-blue-600"];var u,p;function g(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 h.PaneCursorType.Default;let o=Math.atan2(n,i);return o<0&&(o+=2*Math.PI),o>=p.deg337_5||o
=p.deg157_5&&o=p.deg22_5&&o=p.deg202_5&&o=p.deg67_5&&o=p.deg247_5&&o=p.deg112_5&&o=p.deg292_5&&o{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(_(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,d.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 a.SelectionRenderer);return this._selectionRenderers[e]}_getLineAnchorRenderer(e){for(;this._lineAnchorRenderers.length<=e;)this._lineAnchorRenderers.push(new l.LineAnchorRenderer);return this._lineAnchorRenderers[e]}}},86371:(e,t,i)=>{i.d(t,{LineDataSourceProperty:()=>l});var n=i(57600),r=i(35558),o=i(85842),s=i(93445),a=i(47895);class l extends s.DefaultProperty{constructor({templateKeys:e,factoryDefaultsSupplier:t,...i}){let n=t;t&&(n=()=>{const e=t();return(0,a.applyDefaultsOverrides)(e,void 0,void 0,i.defaultName),e}),super({saveNonDefaultUserPreferencesOnly:!0,factoryDefaultsSupplier:n,...i}),this._templateKeys=(0,o.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,s.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,s.extractState)((0,r.default)((0,n.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},43848:(e,t,i)=>{i.r(t),i.d(t,{LineToolTriangle:()=>D});var n=i(82014),r=i(85842),o=i(11284),s=i(47097),a=i(17567),l=i(93445),h=i(82347),d=i(33993),c=i(5829),u=i(88483),p=i(25432),g=i(86371);const _=(0,o.getHexColorByName)("color-minty-green-500"),y=(0,h.generateColor)(_,80),f={intervalsVisibilities:{...u.intervalsVisibilitiesDefaults},fillBackground:!0,linewidth:c.DEFAULT_LINE_TOOL_LINE_WIDTH},P={color:_,backgroundColor:y,transparency:80},x=new Map([[s.StdTheme.Light,P],[s.StdTheme.Dark,P]]),S=(0,l.extractThemedColors)((0,r.ensureDefined)(x.get(s.StdTheme.Light)),(0,r.ensureDefined)(x.get(s.StdTheme.Dark))),m=(0,l.extractAllPropertiesKeys)((0,r.ensureDefined)(x.get(s.StdTheme.Light))),w=(0,l.extractAllPropertiesKeys)(f),T=[...m,...w],v=[...new Set([...T,...p.commonLineToolPropertiesStateKeys])];class M extends g.LineDataSourceProperty{constructor(e){super(e),this.addChild("linesColors",new d.LineToolColorsProperty([this.childs().color]))}static create(e,t){return new this({defaultName:"linetooltriangle",factoryDefaultsSupplier:()=>(0,a.factoryDefaultsForCurrentTheme)(f,x),nonThemedDefaultsKeys:w,themedDefaultsKeys:m,allStateKeys:v,themedColors:S,templateKeys:T,replaceThemedColorsOnThemeChange:!0,state:t,theme:e})}}var b=i(99680),I=i(93489),R=i(41928);class k extends R.LineSourcePaneView{constructor(){super(...arguments),this._renderer=new b.CompositeRenderer,this._triangleRenderer=new I.TriangleRenderer}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_updateImpl(e){super._updateImpl(e),this._renderer.clear();const t=this._source.properties().childs(),i={points:this._points,color:t.color.value(),linewidth:t.linewidth.value(),backcolor:t.backgroundColor.value(),fillBackground:t.fillBackground.value(),transparency:t.transparency.value()};this._triangleRenderer.setData(i),this._renderer.append(this._triangleRenderer),this.addAnchors(this._renderer)}}
class D extends n.LineDataSource{constructor(e,t,i,n){super(e,t??D.createProperties(e.backgroundTheme().spawnOwnership()),i,n),this._setPaneViews([new k(this,this._model)])}pointsCount(){return 3}name(){return"Triangle"}static createProperties(e,t){const i=M.create(e,t);return this._configureProperties(i),i}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(1982),i.e(7686),i.e(2428),i.e(3920),i.e(9328)]).then(i.bind(i,40488))).GeneralFiguresDefinitionsViewModelBase}}},80071:(e,t,i)=>{i.d(t,{intersectLineWithViewport:()=>s});var n=i(57415);function r(e,t,i){return e>=t&&e<=i?e:null}function o(e,t,i,n){return Math.sign(e.x-t.x)===Math.sign(i.x-n.x)&&Math.sign(e.y-t.y)===Math.sign(i.y-n.y)}function s(e,t,i,s,a,l,h){const d=e.x>=0&&e.x<=a&&e.y>=0&&e.y<=l,c=t.x>=0&&t.x<=a&&t.y>=0&&t.y<=l;if(d&&c&&!i&&!s)return[e,t];if(e.x<0&&t.x<0&&(e.xa&&t.x>a&&(e.xl&&t.y>l&&(e.ya)return null;e.yl?l+(e.y-l)%h:l+(h-(l-e.y)%h)),new n.Point(t.x,0))}else if(e.y===t.y){if(e.y<0||e.y>l)return null;e.xa?a+(e.x-a)%h:a+(h-(a-e.x)%h),e.y),new n.Point(0,t.y))}else{const o=(t.y-e.y)/(t.x-e.x),s=e.y-o*e.x;let d=0,c=0;const p=r(s,0,l);if(null!==p)if(h>0&&(e.x<=0||i&&e.x0&&(e.x>=a||i&&e.x>t.x)){const t=e.x>=a?Math.sqrt(Math.pow(e.x-a,2)+Math.pow(e.y-g,2))%h:h-Math.sqrt(Math.pow(e.x-a,2)+Math.pow(e.y-g,2))%h;d=Math.cos(Math.atan(o))*t,c=o*d,u.push(new n.Point(a+d,g+c))}else u.push(new n.Point(a,g));const _=r(-s/o,0,a);if(null!==_&&(0!==_||0!==p))if(h>0&&(e.y<=0||i&&e.y0&&(e.y>=l||i&&e.y>t.y)){const t=e.y>=l?Math.sqrt(Math.pow(e.x-y,2)+Math.pow(e.y-l,2))%h:h-Math.sqrt(Math.pow(e.x-y,2)+Math.pow(e.y-l,2))%h;d=Math.cos(Math.atan(o))*t,c=o*d,u.push(new n.Point(y+Math.sign(o)*d,l+Math.sign(o)*c))}else u.push(new n.Point(y,l))}if(u.length<1)return null;if(u.length<2&&u.push(u[0]),!i&&d){return[e,o(u[0],u[1],e,t)?u[1]:u[0]]}if(!s&&c){return[o(u[0],u[1],e,t)?u[0]:u[1],t]}return o(u[0],u[1],e,t)?[u[0],u[1]]:[u[1],u[0]]}},8165:(e,t,i)=>{i.d(t,{LineAnchorRenderer:()=>f,lineSourcePaneViewPointToLineAnchorPoint:()=>P,lineSourcePaneViewPointToLineAnchorPoint2:()=>x,mapLineSourcePaneViewPointToLineAnchorPoint:()=>S})
;var n=i(57415),r=i(91069),o=i(85842),s=i(51946),a=i(7321),l=i(83077),h=i(28031),d=i(72244),c=i(57507);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 g(e,t,i,n){u(e,t,i-n,n),e.fill(),e.stroke()}function _(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 y(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 c.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,d.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??h.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{i.d(t,{TriangleRenderer:()=>p});var n=i(57415),r=i(17086),o=i(91069),s=i(56568),a=i(83077),l=i(82347),h=i(72244),d=i(51946),c=i(80140),u=i(80071);class p extends s.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e){if(null===this._data||this._data.points.length<2)return null;const[t,i]=this._data.points;let n=(0,r.distanceToSegment)(t,i,e);const s=(0,h.interactionTolerance)().line;if(n.distance<=s)return new a.HitTestResult(a.HitTarget.MovePoint);if(3!==this._data.points.length)return null;const l=this._data.points[2];return n=(0,r.distanceToSegment)(i,l,e),n.distance<=s?new a.HitTestResult(a.HitTarget.MovePoint):(n=(0,r.distanceToSegment)(l,t,e),n.distance<=s?new a.HitTestResult(a.HitTarget.MovePoint):this._data.fillBackground&&(0,o.pointInTriangle)(e,t,i,l)?new a.HitTestResult(a.HitTarget.MovePointBackground):null)}_drawImpl(e){if(null===this._data||this._data.points.length<2)return;const t=e.context,i=(this._data.linestyle??c.LINESTYLE_SOLID)===c.LINESTYLE_SOLID?"round":"butt";t.lineCap=i,t.lineJoin="round",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,void 0!==this._data.linestyle&&(0,d.setLineStyle)(t,this._data.linestyle);const[r,o,s=o]=this._data.points,{mediaSize:a}=e;if(this._data.fillBackground&&Math.abs((r.x-s.x)*(o.y-s.y)-(o.x-s.x)*(r.y-s.y))>1e-10){let e=[new n.Point(0,0),new n.Point(a.width,0),new n.Point(a.width,a.height),new n.Point(0,a.height)];if(e=(0,d.clipPolygonByEdge)(e,r,o,[o,s]),e=(0,d.clipPolygonByEdge)(e,o,s,[s,r]),e=(0,d.clipPolygonByEdge)(e,s,r,[r,o]),e&&e.length>1){t.save(),t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let i=1;ie+t),0);[[r,o],[o,s],[s,r]].forEach((([e,t])=>{const i=(0,u.intersectLineWithViewport)(e,t,!1,!1,a.width,a.height,p);i&&h.push(i)})),h.length&&(t.beginPath(),h.forEach((([e,i])=>{t.moveTo(e.x,e.y),t.lineTo(i.x,i.y)})),t.stroke())}}},17567:(e,t,i)=>{i.d(t,{factoryDefaultsForCurrentTheme:()=>l});var n=i(35558),r=i(57600),o=i(85842),s=i(49841),a=i(47097);function l(e,t){const i=s.watchedTheme.value()??a.StdTheme.Light,l=(0,r.default)(e);return(0,n.default)(l,(0,o.ensureDefined)(t.get(i))),l}}}]);