diff --git a/.github/workflows/gh-pages-deploy.yml b/.github/workflows/gh-pages-deploy.yml deleted file mode 100644 index b35d82b..0000000 --- a/.github/workflows/gh-pages-deploy.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: GitHub Pages - -on: - push: - branches: [master] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Use Node.js 16.x - uses: actions/setup-node@v1 - with: - node-version: "16.x" - - - name: Build - env: - LCJS_LICENSE: ${{ secrets.LCJS_DEPLOY_LICENSE }} - run: | - npm install - npm run build - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist - publish_branch: gh-pages diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 5b5e356..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -dist - diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f9b2960..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 LightningChart Ltd. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index d306c4d..0000000 --- a/README.md +++ /dev/null @@ -1,132 +0,0 @@ -# JavaScript Heatmap Spectrogram Chart - - - -This demo application belongs to the set of examples for LightningChart JS, data visualization library for JavaScript. - -LightningChart JS is entirely GPU accelerated and performance optimized charting library for presenting massive amounts of data. It offers an easy way of creating sophisticated and interactive charts and adding them to your website or web application. - -The demo can be used as an example or a seed project. Local execution requires the following steps: - -- Make sure that relevant version of [Node.js](https://nodejs.org/en/download/) is installed -- Open the project folder in a terminal: - - npm install # fetches dependencies - npm start # builds an application and starts the development server - -- The application is available at _http://localhost:8080_ in your browser, webpack-dev-server provides hot reload functionality. - - -## Description - -This example shows a simple use case for Heatmaps as a spectrogram. - -Spectrogram is a visual representation of the spectrum of frequencies. Spectrograms can be used to visualize any wave form. Most often spectrograms are used to display audio signals. - -This example loads a audio file and shows spectrograms for each channel on the audio file. - -The spectrogram shows frequency on one axis (Y Axis) and time on the other (X Axis). The color of a the heatmap at any point is the amplitude of the frequency at the specified time. - -## Getting the data - -First the audio file that will be shown is loaded with [fetch][fetch] and converted into an ArrayBuffer. - -```js -const response = await fetch('url') -const buffer = await response.arrayBuffer() -``` - -This example uses the [Web Audio APIs][web-audio-api] to retrieve the frequency data to display in the heatmap. These APIs make it easy to work with audio files and manipulate the files. For spectrogram use the [AnalyzerNode][analyzer-node] is the most useful part of the API as it provides [getByteFrequencyData][getbytefrequencydata] method which is a implementation of [Fast Fourier Transform][fft]. -The AudioContext contains method to convert an ArrayBuffer into an [AudioBuffer][audiobuffer]. - -```js -const audioBuffer = await audioContext.decodeAudioData(buffer) -``` - -Now that the audio file is converted into a AudioBuffer it's possible to start extracting data from it. - -To process the full audio buffer as fast as possible, a [OfflineAudioContext][offlineaudiocontext] is used. The OfflineAudioContext doesn't output the data to a audio device, instead it will go through the audio as fast as possible and outputs an AudioBuffer with the processed data. In this example the processed audio buffer is not used, but the processing is used to calculate the FFT data we need to display the intensities for each frequency in the spectrogram. The audio buffer we have created is used as a [buffer source][createbuffersource] for the OfflineAudioContext. - -The buffer source only has a single output but we want to be able to process each channel separately, to do this a [ChannelSplitter][createchannelsplitter] is used with the output count matching the source channel count. - -```js -const splitter = offlineCtx.createChannelSplitter(source.channelCount) -``` - -This makes it possible to process each channel separately by making it possible to create AnalyzerNodes for each channel and only piping a single channel to each analyzer. - -A [ScriptProcessorNode][createscriptprocessor] is used to go through the audio buffer in chuncks. For each chunk, the FFT data is calculated for each channel and stored in large enough buffers to fit the full data. - -Last [startRendering()][start-rendering] method is called to render out the audio buffer. This is when all of the FFT calculation is done. - -## Showing the data - -Each channel of the audio file is shown in it's own chart inside a single dashboard. When the data is calculated, a dashboard is made. This dashboard is then passed to functions that setup the charts inside the dashboard and create the heatmap series based on the script processor buffer size and fft resolution. - -The data from the audio APIs is in wrong format to display in the heatmap without editing it. The heatmap data has to be mapped from the one dimensional array it was generated in to a two dimensional array. This mapping in this example is done with `remapDataToTwoDimensionalMatrix` function, this function maps the data in columns. If the heatmap was displayed vertically, then the mapping would be easier as each stride of data could just be placed as a row. - -```js -// Datamapping for vertical spectrogram -const output = Array.from(Array(tickCount)).map(() => Array.from(Array(strideSize))) -for (let row = 0; row < strideSize; row += 1) { - output[row] = arr.slice(row * strideSize, row * strideSize + strideSize) -} -``` - -[web-audio-api]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API -[analyzer-node]: https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode -[getbytefrequencydata]: https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData -[fft]: https://en.wikipedia.org/wiki/Fast_Fourier_transform -[fetch]: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch -[audiobuffer]: https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer -[offlineaudiocontext]: https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext -[createbuffersource]: https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createBufferSource -[createchannelsplitter]: https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createChannelSplitter -[createsciptprocessor]: https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createScriptProcessor -[start-rendering]: https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext/startRendering - - -## API Links - -* [Heatmap Grid Series Intensity] -* [Paletted Fill Style] -* [LUT] -* [Dashboard] -* [Automatic axis scrolling options] -* [Automatic axis tick placement options] -* [Color factory HSV] -* [Empty fill style] -* [Empty line style] - - -## Support - -If you notice an error in the example code, please open an issue on [GitHub][0] repository of the entire example. - -Official [API documentation][1] can be found on [LightningChart][2] website. - -If the docs and other materials do not solve your problem as well as implementation help is needed, ask on [StackOverflow][3] (tagged lightningchart). - -If you think you found a bug in the LightningChart JavaScript library, please contact sales@lightningchart.com. - -Direct developer email support can be purchased through a [Support Plan][4] or by contacting sales@lightningchart.com. - -[0]: https://github.com/Arction/ -[1]: https://lightningchart.com/lightningchart-js-api-documentation/ -[2]: https://lightningchart.com -[3]: https://stackoverflow.com/questions/tagged/lightningchart -[4]: https://lightningchart.com/support-services/ - -© LightningChart Ltd 2009-2025. All rights reserved. - - -[Heatmap Grid Series Intensity]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/classes/HeatmapGridSeriesIntensityValues.html -[Paletted Fill Style]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/classes/PalettedFill.html -[LUT]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/classes/LUT.html -[Dashboard]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/classes/Dashboard.html -[Automatic axis scrolling options]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/variables/AxisScrollStrategies.html -[Automatic axis tick placement options]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/variables/AxisTickStrategies.html -[Color factory HSV]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/functions/ColorHSV.html -[Empty fill style]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/variables/emptyFill-1.html -[Empty line style]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/variables/emptyLine.html - diff --git a/assets/Truck_driving_by-Jason_Baker-2112866529.wav b/examples/assets/0802/Truck_driving_by-Jason_Baker-2112866529.wav similarity index 100% rename from assets/Truck_driving_by-Jason_Baker-2112866529.wav rename to examples/assets/0802/Truck_driving_by-Jason_Baker-2112866529.wav diff --git a/assets/Truck_driving_by-Jason_Baker-2112866529_edit.wav b/examples/assets/0802/Truck_driving_by-Jason_Baker-2112866529_edit.wav similarity index 100% rename from assets/Truck_driving_by-Jason_Baker-2112866529_edit.wav rename to examples/assets/0802/Truck_driving_by-Jason_Baker-2112866529_edit.wav diff --git a/assets/play_circle_outline-24px.svg b/examples/assets/0802/play_circle_outline-24px.svg similarity index 100% rename from assets/play_circle_outline-24px.svg rename to examples/assets/0802/play_circle_outline-24px.svg diff --git a/heatmapSpectrogram.png b/heatmapSpectrogram.png deleted file mode 100644 index 007fa6f..0000000 Binary files a/heatmapSpectrogram.png and /dev/null differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..b23b39d --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +
p)return[{x:h,y:u},{x:d,y:u},{x:d,y:p},{x:l,y:p},{x:l,y:c},{x:h,y:c}];if(gc)return[{x:h,y:u},{x:d,y:u},{x:d,y:c},{x:h,y:c}];if(g{o[t]=e}),this.appendSamples(o,e),this}appendSample(t,e){const i=Object.keys(t).filter(t=>(!(null==e?void 0:e.whitelist)||e.whitelist.includes(t))&&(!(null==e?void 0:e.blacklist)||!e.blacklist.includes(t)));if(0===i.length)return this;const s=Object.fromEntries(i.map(e=>{var i,s;return[e,Ro(t[e],this.zu&&null!==(s=null===(i=this.zu[e])||void 0===i?void 0:i.dataStorage)&&void 0!==s?s:Float64Array)]})),r=this.Vu({appendCount:1,keys:i,parsedDataArrs:s,opts:e});if(!r.incomingDataReplacedCache&&this.Iu){let t=this.Nu(s);if(t=t&&t.filter(t=>this.zu&&this.zu[t].Ou&&!("autoDetectResult"in this.zu[t].Ou)),t&&t.length>0)if(this.Pu);else{t.length>1&&this.Pa&&_t.console.warn("LightningChart JS warning - DataSetXY data pushed in order that doesn't match data pattern. Automatic sorting is attempted, but there is more than 1 data pattern mismatch. Behavior may be compromised.");for(const e of t){const t=this.zu?this.zu[e]:void 0;if(!(t&&t.Ou&&"autoDetectResult"in t.Ou))return this.Gu(e,{parsedDataArrs:Object.fromEntries(r.keys.map(t=>[t,"number"==typeof s[t]?new Array(1).fill(s[t]):s[t]])),offset:0,count:1}),this}_t.console.error(`LightningChart JS error - data is arriving in wrong order and auto sorting is either disabled or not applicable. Chart functionality is compromised. Following data properties didn't match their configured pattern: ${t.map(t=>`'${t}'`).join(", ")}`)}}for(const t of r.keys){const e=r.buckets[t].cache;if(!e)continue;const i=s[t];e[this.ku]="number"==typeof i?i:i[0]}return this.D.R("change",{type:"change",iDataStart:this.ku,iDataEnd:this.ku}),this.ku+=1,this.ku>r.maxSampleCount-1&&(this.ku=0,this.Fu=!0,this.D.R("loop",{type:"loop"})),this.Cu=Math.min(this.Cu+1,r.maxSampleCount),this.Tu+=1,this}appendSamples(t,e){const i=Object.keys(t);if(0===i.length)return this;const s=Object.entries(t).filter(([,t])=>"object"==typeof t&&"length"in t).map(t=>t[0]),r=s.reduce((e,i)=>Math.min(e,t[i].length),Number.MAX_SAFE_INTEGER);s.forEach(e=>{const i=t[e];i.length>r&&(_t.console.warn(`LightningChart JS warning - insymmetric DataSetXY input (${e}). Extra measurements will be dropped`),Array.isArray(i)?this.Bu?i.length=r:t[e]=i.slice(0,r):t[e]=i.subarray(0,r))});let n=null==e?void 0:e.offset,o=null==e?void 0:e.count;if(n=void 0!==n?n:0,o=void 0!==o?o:r-n,o<=0)return this;const a=Object.fromEntries(i.map(e=>{var i,s;const r=t[e];return this.zu&&this.zu[e]&&void 0!==this.zu[e].dataStorage||this.Ru||!Vo(r)?[e,Ro(t[e],this.zu&&null!==(s=null===(i=this.zu[e])||void 0===i?void 0:i.dataStorage)&&void 0!==s?s:Float64Array)]:[e,r]})),h=this.Vu({appendCount:o,keys:i,parsedDataArrs:a,opts:e});if(Object.entries(h.buckets).forEach(([t,e])=>{if(0===this.Cu&&e.ensureNoDuplication){const i=a[t],s=e.cache;if(Array.isArray(i)||s!==i)throw new Error(`LightningChart JS error | DataSetXY ensureNoDuplication check failed for '${t}'`)}}),!h.incomingDataReplacedCache&&this.Iu){let t=this.Nu(a);if(t=t&&t.filter(t=>this.zu&&this.zu[t].Ou&&!("autoDetectResult"in this.zu[t].Ou)),t&&t.length>0)if(this.Pu);else{t.length>1&&this.Pa&&_t.console.warn("LightningChart JS warning - DataSetXY data pushed in order that doesn't match data pattern. Automatic sorting is attempted, but there is more than 1 data pattern mismatch. Behavior may be compromised.");for(const e of t){const t=this.zu?this.zu[e]:void 0;if(!(t&&t.Ou&&"autoDetectResult"in t.Ou))return this.Gu(e,{parsedDataArrs:Object.fromEntries(i.map(t=>[t,"number"==typeof a[t]?new Array(o).fill(a[t]):a[t]])),offset:n,count:o}),this}_t.console.error(`LightningChart JS error - data is arriving in wrong order and auto sorting is either disabled or not applicable. Chart functionality is compromised. Following data properties didn't match their configured pattern: ${t.map(t=>`'${t}'`).join(", ")}`)}}const l=h.maxSampleCount-this.ku,u=Math.min(o,l);if(u>0){if(!h.incomingDataReplacedCache)for(const t of h.keys){const e=h.buckets[t].cache,i=a[t];Bo(e,i,n,u,this.ku)}this.D.R("change",{type:"change",iDataStart:this.ku,iDataEnd:this.ku+u-1}),this.ku+=u,this.ku>h.maxSampleCount-1&&(this.ku=0,this.Fu=!0,this.D.R("loop",{type:"loop"}))}if(this.Cu=Math.min(this.Cu+u,h.maxSampleCount),this.Tu+=u,o-u>0&&!h.incomingDataReplacedCache){const t={};for(const e of h.keys)t[e]=Pt(a[e],n+u,void 0);this.appendSamples(t,e)}else this.$u();return this}fill(t){return this.zu?(Object.keys(t).forEach(t=>{this.zu&&!this.zu[t]&&this.Pa&&_t.console.warn(`LightningChart JS warning - DataSetXY.fill() tried to fill data property that doesn't exist in schema ("${t}")`)}),Object.entries(this.zu).forEach(([e,i])=>{let s=t[e];i.cache&&void 0!==s&&(b(s)&&(s=s.toUint32()),i.cache.fill(s))}),this.D.R("clear",{type:"clear"}),this):this}setSamples(t,e){return this.clear().appendSamples(t,e)}alterSamplesStartingFrom(t,e,i){var s,r,n;const o=Object.values(e).find(t=>"number"!=typeof t);let a=null==i?void 0:i.offset,h=null==i?void 0:i.count;const l=o?o.length:1;if(a=void 0!==a?a:0,h=void 0!==h?h:l-a,h<=0)return this;const u=Object.keys(e),c=Object.fromEntries(u.map(t=>{var i,s;return[t,Ro(e[t],this.zu&&null!==(s=null===(i=this.zu[t])||void 0===i?void 0:i.dataStorage)&&void 0!==s?s:Float64Array)]})),d=this.Tu-1,f=void 0!==this.Uu?Math.max(this.Tu-this.Uu,0):0,g=t+h-1,p=Math.max(t,f),m=Math.min(g,d),y=m-p+1;if(this.Tu>0&&y>0){const e=this.Vu({appendCount:0,keys:u,parsedDataArrs:c,opts:i}),o=null!==(n=null===(r=null===(s=Object.values(e.buckets).find(t=>t.cache))||void 0===s?void 0:s.cache)||void 0===r?void 0:r.length)&&void 0!==n?n:0;if(void 0!==this.Uu&&this.Fu&&this.Tu%this.Uu!=0){const i=this.Tu-this.Tu%this.Uu,s=this.Tu-1,r=this.Tu-this.Cu,n=i-1,h=Math.max(p,r),l=Math.min(m,n)-h+1;if(l>0){const i=h-t,s=Co(h,this.Tu,o,this.ku);for(const t of e.keys){const r=e.buckets[t].cache,n=c[t];Bo(r,n,a+i,l,s)}}const u=Math.max(p,i),d=Math.min(m,s)-u+1;if(d>0){const i=u-t,s=Co(u,this.Tu,o,this.ku);for(const t of e.keys){const r=e.buckets[t].cache,n=c[t];Bo(r,n,a+i,d,s)}}}else{const t=p-f;for(const i of e.keys){const s=e.buckets[i].cache,r=c[i];Bo(s,r,a,y,t)}}this.D.R("clear",{type:"clear"})}const x=t+h-1-d;if(x>0){const i=m+1-t;this.appendSamples(e,{offset:a+i,count:x})}return this}alterSamplesByIndex(t,e){var i;if(!this.zu)return this;const s=t.length,r=Object.keys(e),n=Object.fromEntries(r.map(t=>{var i,s;return[t,Ro(e[t],this.zu&&null!==(s=null===(i=this.zu[t])||void 0===i?void 0:i.dataStorage)&&void 0!==s?s:Float64Array)]})),o=this.Tu-1,a=void 0!==this.Uu?Math.max(this.Tu-this.Uu,0):0;if(s<=0)return this;let h=!1;const l=Object.values(this.zu).find(t=>t.cache).cache.length;for(let e=0;eo)continue;const u=Co(s,this.Tu,l,this.ku);for(const t of r){const s=null===(i=this.zu[t])||void 0===i?void 0:i.cache,r=n[t];s&&(s[u]="number"==typeof r?r:r[e],h=!0)}}return h&&this.D.R("clear",{type:"clear"}),this}alterSamplesByMatch(t,e,i){var s;if(!this.zu)return this;const r=e.length,n=this.Cu,o=this.Tu-1,a=Math.max(o-n+1,0),h=Object.keys(i),l=Object.fromEntries(h.map(t=>{var e,s;return[t,Ro(i[t],this.zu&&null!==(s=null===(e=this.zu[t])||void 0===e?void 0:e.dataStorage)&&void 0!==s?s:Float64Array)]}));if(r<=0)return this;let u=!1;const c=this.zu[t].cache,d=this.ju(t);if(!c)return this;const f=c.length;for(let i=0;ivoid 0===t?void 0:Array.isArray(t)?new e(t):t instanceof e?t:new e(t),Po=/^(\d{4}-\d{2}-\d{2})(?:T(\d{2}:\d{2}:\d{2}(?:\.\d+)?)(Z|[+-]\d{2}:\d{2})?)?$/,zo=t=>"string"==typeof t&&Po.test(t)&&!_t.isNaN(Date.parse(t)),Ro=(t,e)=>{if("number"==typeof t)return t;if(b(t))return t.toUint32();if(t instanceof Date)return t.getTime();if("string"==typeof t){if(zo(t))return new Date(t).getTime();throw new Error("LightningChart JS error - XY coordinate supplied as unrecognized String format. Coordinates must be Numbers, Date objects or ISO 8601 Date strings")}const i=t.length,s=t[0]&&t[0]instanceof Date,r=t[0]&&zo(t[0]),n=t[0]&&b(t[0]);if(!r&&t[0]&&"string"==typeof t[0])throw new Error("LightningChart JS error - XY coordinate supplied as unrecognized String format. Coordinates must be Numbers, Date objects or ISO 8601 Date strings");if(r){const s=new e(i);for(let e=0;e{if(t&&Array.isArray(t))return Float64Array;const e="object"==typeof t?Object.getPrototypeOf(t).constructor:void 0;return null!=e?e:Float64Array},Vo=t=>!!t&&!Array.isArray(t)&&(t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array);class Oo extends bo{constructor(t,e,i,s,r){var n;super(t,e,i,s,r),this.Al="label",this.bu=this.Xs.bn(this.renderingScale).Qh(this.Al).qe(Ki).xn(Ne).Sn(Ne),this.setMargin(null!==(n=r.uiTextPadding)&&void 0!==n?n:5),this.D.zi(this.bu)}On(){return[this.bu]}setFillStyle(t){return this.bu.qe(t),this.Xs.Ds(),this}getFillStyle(){return this.bu.xh()}ir(){void 0!==this.Gn&&this.bu.sl(this.Gn);const t=this.getPosition(l(0,0),e.UISpace.Content),i=K(t,this.scale,this.renderingScale);return this.bu.sr(i),this.bu.Zr=this.Zr,this}Oh(){this.bu.Oh();const t=0===this.Al.length?l(0,0):this.bu.vu();return this.setContentSize(t),super.Oh()}setText(t){return this.Al=t,this.bu.Qh(this.Al),this.Xs.Ds(),this}getText(){return this.Al}setFont(t){return this.bu.wh(t),this.Xs.Ds(),this}getFont(){return this.bu.Mh()}setTextRotation(t){return this.bu._h(t),this.Xs.Ds(),this}getTextRotation(){return this.bu.kh()}}const No={...Nn,...Gn,uiElement:Oo};class Uo extends Eo{constructor(t,e,i,s,r){super(t,e,i,s,r),this.fitTo=this.$n.bind(this),this.setSize=this.fitTo,this.bu=this.Xs.Ad(e).qe(Ki).Ke(It),this.gd=this.bu.$o(),this.D.zi(this.bu)}On(){return[this.bu]}setCornerRadius(t,e){var i,s,r,n;return this.pd=t,this.gd.vd(t?{extent:t,c_x1_y1:null===(i=null==e?void 0:e.bottomLeft)||void 0===i||i,c_x1_y2:null===(s=null==e?void 0:e.topLeft)||void 0===s||s,c_x2_y1:null===(r=null==e?void 0:e.bottomRight)||void 0===r||r,c_x2_y2:null===(n=null==e?void 0:e.topRight)||void 0===n||n,skipTooSmallCheck:!!e}:void 0),this.Xs.Ds(),this}getCornerRadius(){return this.pd}setFillStyle(t){return this.bu.qe(t),this.Xs.Ds(),this}getFillStyle(){return this.bu.xh()}setStrokeStyle(t){return this.bu.Ke(t),this.Xs.Ds(),this}getStrokeStyle(){return this.bu.Ha()}ir(){void 0!==this.Gn&&this.bu.sl(this.Gn);const t=di([this.getPosition(l(-1,-1),e.UISpace.Content),this.getPosition(l(1,1),e.UISpace.Content)].map(t=>K(t,this.scale,this.renderingScale)));return this.gd.yd(t.min.x,t.min.y,t.max.x,t.max.y),this}$n(t){return this.setContentSize(t),this.Xs.Ds(),this}Un(){return 0}jn(){return 0}Hn(){return 0}Yn(){return 0}}class Go extends Eo{constructor(t,e,i,s,r){super(t,e,i,s,r),this.md=l(0,0),this.bu=t.xd(e).Jc(0).Ar(360).qe(Ki).Ke(It),this.D.zi(this.bu)}On(){return[this.bu]}setFillStyle(t){return this.bu.qe(t),this.Xs.Ds(),this}getFillStyle(){return this.bu.xh()}setStrokeStyle(t){return this.bu.Ke(t),this.Xs.Ds(),this}getStrokeStyle(){return this.bu.Ha()}ir(){void 0!==this.Gn&&this.bu.sl(this.Gn);const t=this.getSize(e.UISpace.Content).x/2;return this.bu.Kc(t*this.renderingScale.ni().x).qc(t*this.renderingScale.ni().y).sr(K(this.getPosition(l(0,0),e.UISpace.Content),this.scale,this.renderingScale)).iu(255).Oh(),this}$n(t){const e=Math.sqrt(t.x*t.x/4+t.y*t.y/4);return this.setContentSize(l(2*e,2*e)),this.md=t,this.Xs.Ds(),this}Un(){return(this.getSize(e.UISpace.Content).x-this.md.x)/2}jn(){return(this.getSize(e.UISpace.Content).x-this.md.x)/2}Hn(){return(this.getSize(e.UISpace.Content).y-this.md.y)/2}Yn(){return(this.getSize(e.UISpace.Content).y-this.md.y)/2}fitTo(t){const e=Math.min(t.x,t.y);return this.setContentSize(l(e,e)),this.md=t,this}}class Yo extends Mo{constructor(t,e,i,s,r){super(t,e,i,mo.Simple,s,r),this.Sd=m(l(0,0)),this.bd=!1,this.wu()}_u(){const t=this.Sd.T();if(this.bd){const e=Math.min(t.x,t.y);return[l(0,0),l(e/2,e/2),l(0,e),l(-e/2,e/2)]}const e=2*Math.sqrt(this.Sd.T().x*this.Sd.T().x/4+this.Sd.T().y*this.Sd.T().y/4),i=l(Math.cos(Math.PI/4)*e,0),s=l(0,Math.sin(Math.PI/4)*e),r=l(0,0),n=Ei(r,Ei(i,s)),o=Ei(n,Ei(s,bi(i,-1)));return[r,n,o,Mi(o,Ei(i,s))]}On(){return[this.bu]}setFillStyle(t){return this.bu.qe(t),this.Xs.Ds(),this}getFillStyle(){return this.bu.xh()}setStrokeStyle(t){return this.bu.Ke(t),this.Xs.Ds(),this}getStrokeStyle(){return this.bu.Ha()}$n(t){return this.Sd.C(t),this.bd=!1,this.Xs.Ds(),this}Un(){return this.bd?0:(this.getSize(e.UISpace.Content).x-this.Sd.T().x)/2}jn(){return this.bd?0:(this.getSize(e.UISpace.Content).x-this.Sd.T().x)/2}Hn(){return this.bd?0:(this.getSize(e.UISpace.Content).y-this.Sd.T().y)/2}Yn(){return this.bd?0:(this.getSize(e.UISpace.Content).y-this.Sd.T().y)/2}fitTo(t){return this.Sd.C(t),this.bd=!0,this.Xs.Ds(),this}}class Xo extends Mo{constructor(t,i,s,r,n){super(t,i,s,mo.Simple,r,n),this.Md=m(l(0,0)),this.wd=m(10),this._d=m(void 0),this.qn=m(e.UIDirections.Right),this.wu()}On(){return[this.bu]}setFillStyle(t){return this.bu.qe(t),this.Xs.Ds(),this}getFillStyle(){return this.bu.xh()}setStrokeStyle(t){return this.bu.Ke(t),this.Xs.Ds(),this}getStrokeStyle(){return this.bu.Ha()}setDirection(t){return this.qn.C(t),this.Xs.Ds(),this}getDirection(){return this.qn.T()}setPointerLength(t){return this.wd.C(t),this.Xs.Ds(),this}getPointerLength(){return this.wd.T()}setPointerAngle(t){return this._d.C(t),this.Xs.Ds(),this}getPointerAngle(){let t=this._d.T();if(void 0===t){const e=this.kd();if(0===e)return 0;t=0!==e?180*Math.atan(2*this.getPointerLength()/e)/Math.PI:0}return Math.min(Math.max(t,1),89)}$n(t){return this.Md.C(t),this.Xs.Ds(),this}Cd(){const t=this.getPointerAngle();return 0===t?0:2*this.getPointerLength()/Math.tan(t*Math.PI/180)}Td(){return he(this.qn.T())?this.Md.T().x:this.Md.T().y}kd(){return he(this.qn.T())?this.Md.T().y:this.Md.T().x}Un(){switch(this.qn.T()){case e.UIDirections.Right:return 0;case e.UIDirections.Left:return this.getPointerLength();case e.UIDirections.Up:case e.UIDirections.Down:return Math.max(0,this.Cd()-this.kd());default:return 0}}jn(){switch(this.qn.T()){case e.UIDirections.Right:return this.getPointerLength();case e.UIDirections.Left:return 0;case e.UIDirections.Up:case e.UIDirections.Down:return Math.max(0,this.Cd()-this.kd());default:return 0}}Hn(){switch(this.qn.T()){case e.UIDirections.Right:case e.UIDirections.Left:return Math.max(0,this.Cd()-this.kd());case e.UIDirections.Up:return this.getPointerLength();case e.UIDirections.Down:default:return 0}}Yn(){switch(this.qn.T()){case e.UIDirections.Right:case e.UIDirections.Left:return Math.max(0,this.Cd()-this.kd());case e.UIDirections.Up:return 0;case e.UIDirections.Down:return this.getPointerLength();default:return 0}}_u(){const t=ae(this.qn.T()),e=vi(l(0,0),t),i=this.getPointerLength(),s=this.Cd(),r=this.Td(),n=this.kd();if(!(0!==i&&0!==s||0!==r&&0!==n))return[];const o=l(0,0),a=Ei(Ei(o,bi(t,-i)),bi(e,s/2)),h=Ei(a,bi(e,(n-s)/2)),u=Ei(h,bi(t,-r)),c=Ei(Ei(o,bi(t,-i)),bi(e,-s/2)),d=Ei(c,bi(e,-(n-s)/2)),f=Ei(d,bi(t,-r));let g;return g=0===r||0===n?[o,a,c]:0===i||0===s?[h,u,f,d]:Yt(n,s)?[o,a,u,f,c]:[o,a,h,u,f,d,c],g}}class Ho extends bo{constructor(t,e,i,s,r){super(t,e,i,s,r),this.fitTo=this.$n.bind(this),this.setSize=this.fitTo,this.Fd=new wo,this.bu=this.Xs.Bd(e).ur(It).Ld(Ki).Pd(Ki).Id(this.Fd,{x:"x",y:"y"}),this.D.zi(this.bu)}On(){return[this.bu]}setShape(t){return this.bu.Dd(t),this}getShape(){return this.bu.Rd()}setRotation(t){return this.bu.Ed(t),this}getRotation(){return this.bu.Od()}setFillStyle(t){return this.bu.Pd(t),this.Xs.Ds(),this}getFillStyle(){return this.bu.zd()}setStrokeStyle(t){return this.bu.Vd(t),this.Xs.Ds(),this}getStrokeStyle(){return this.bu.Nd()}ir(){void 0!==this.Gn&&this.bu.sl(this.Gn);const t=K(this.getPosition({x:0,y:0},e.UISpace.Content),this.scale,this.renderingScale),i=Math.max(this.size.x,this.size.y);if(this.Fd.clear(),i>0){const e=this.bu.Rd(),s=this.bu.zd(),r=ar(e)&&e,n=Et(s)&&s;if(r){const t=i/r.kt().y;this.bu.Gd(t)}else if(n){const t=n.source;if(t instanceof Image){const e=i/t.height;this.bu.Gd(e)}}else this.bu.Gd(i);this.Fd.appendSample(t)}return this}$n(t){return this.setContentSize(t),this.Xs.Ds(),this}Un(){return 0}jn(){return 0}Hn(){return 0}Yn(){return 0}}const jo={...Nn,...Gn,uiElement:Ho};class $o extends Xn{setSize(t){return this.setContentSize(t),this.Xs.Ds(),this}}class Zo extends Bn{constructor(){super(...arguments),this.$d=[],this.Ud=0,this.jd=t=>{const e=this.$d.indexOf(t);e>=0&&this.$d.splice(e,1)}}getMembers(){return this.$d}getMemberCount(){return this.$d.length}setMinimumSize(t){return this.Yd=t,this.Xs.Ds(),this}getMinimumSize(){return this.Yd}addElement(t,e=-1){const i=t.no(this.Xs,this.renderingScale,this.scale,this.jd,this.bi,!1);return i.setPointerEvents(this.getPointerEvents()),e>=0?this.$d.splice(e,0,i):this.$d.push(i),i.setVisible(this.getVisible()),this.D.Gi(i),this.ui&&(we(0,()=>{}),i.dispose()),i}dispose(){return super.dispose(),this.$d.slice().forEach(Ut),this}ir(){super.ir(),this.$d.forEach(t=>{t.Zr=this.Zr});const t=this.Gn;return void 0!==t&&this.$d.forEach((e,i)=>{e.Gn=t+1+.01*i}),this}setVisible(t){return super.setVisible(t),this.$d.forEach(e=>e.setVisible(t)),this}setPointerEvents(t){super.setPointerEvents(t);for(let e=0;et.axis===this))||void 0===t?void 0:t.iStack)&&void 0!==e?e:0}getParallelIndex(){var t,e;return null!==(e=null===(t=[...this.chart.wA,...this.chart._A,...this.chart.kA,...this.chart.CA].find(t=>t.axis===this))||void 0===t?void 0:t.iParallel)&&void 0!==e?e:0}TA(){return this.kf}FA(t,i){i=i||Sa.AxisTickMajor;const s=new Rn(this,t?this.zf[0]:this.Uf,this.Uf,this.ai,this.Kf,this.Kf,this.hh,this.Wf,this.Ef,this.bi,i).setTextFormatter(this.formatValue);return this.Cf.push(s),this.Vh=void 0,"other"===s.ho.oo&&(s.ho.Zr=e.TextObjectIdentifier.CursorTickMarker),s}IA(t,e){const i=-this.hh.getWidth(e);this.pan(i)}pan(t,e){var i,s;const r=this.fh,n=this.Ah,o=this.ai.Qt(r,t),a=this.ai.Qt(n,t);this.Lh(o,a,{allowIntervalLengthChange:!1,skipIntervalRestriction:!1});const h=this.bh();if(!1!==(null==e?void 0:e.releaseScrollingAxisIfLiveReached)&&(null===(i=this.Bh)||void 0===i?void 0:i.id)===nn&&this.Er&&h){const t=this.vr({forStart:o,forEnd:a,allowIntervalLengthChange:!1});t&&(this.Ah>this.fh&&this.Ah>=t.end||this.Ahs){const t=(o.max.y-o.min.y)*(n/s-1);o.min.y-=t/2,o.max.y+=t/2}e.x.W(o.min.x,o.max.x),e.y.W(o.min.y,o.max.y);const a=this.ai.x.Tt(),h=this.ai.y.Tt();this.D.R("viewchange",{latitudeRange:{start:o.min.y,end:o.max.y},longitudeRange:{start:o.min.x,end:o.max.x},margin:{top:h[1],bottom:h[0],left:a[0],right:a[1]}})}gx(t){this.Mx=t,this.pi.Ds()}vx(){this.Mx=void 0,this.pi.Ds()}Ax(t,e){const i=Array.from(this.qm.entries()).findIndex(([t,i])=>i.includes(e)),s=null==t?void 0:t.regions[i],r=this.pi.ka();if(!r)return;const n=this.pi.Qa(r),o=this.xx&&this.xx[i];let a=K({x:n.engineX,y:n.engineY},this.pi.ai,this.ai);a={x:Xt(a.x,this.ai.x.getInnerStart(),this.ai.x.getInnerEnd()),y:Xt(a.y,this.ai.y.getInnerStart(),this.ai.y.getInnerEnd())};let h=a.x,l=a.y;const u=s.transform;s.outlier&&u&&(h=(h-u.translate.x-u.vertexBoundaries.min.x)/u.scale.x+u.vertexBoundaries.min.x,l=(l-u.translate.y-u.vertexBoundaries.min.y)/u.scale.y+u.vertexBoundaries.min.y);const c=this.getFillStyle();return{cursorPosition:{pointMarker:{x:n.engineX,y:n.engineY},pointMarkerScale:this.pi.ai,resultTable:{x:n.engineX,y:n.engineY},resultTableScale:this.pi.ai},region:s,value:o,longitude:l,latitude:h,lut:os(c)?c.lut:void 0}}setCursor(t){return this.Dm.setCursor(t),this}getCursor(){return this.Dm.getCursor()}setCursorMode(t){return this.Dm.setCursorMode(t),this}getCursorMode(){return this.Dm.getCursorMode()}setCustomCursor(t){return this.Dm.setCustomCursor(t),this}setCursorDynamicBehavior(t){return this.Dm.Um(t),this}setCursorFormatting(t){return this.Dm.setCursorFormatting(t),this}getCursorFormatting(){return this.Dm.getCursorFormatting()}addCursor(t=Ll){const e=this.Cg(),i=t.im(e,this.uiScale,this.uiScale,this.Mg(e),this.bi);return this.Rg(i),i}setAnimationsEnabled(t){return this.Rr=!t,this}getAnimationsEnabled(){return this.Rr}getMinimumSize(){}Ag(){return[this]}ir(t){super.ir(t),super.Eg();const e=Fh.Hg(this.jr,this.Vg),i=this.zs.reduce((t,i)=>{const s=i.Oh(e,this.zn);return{top:Math.max(t.top,s.top),bottom:Math.max(t.bottom,s.bottom),left:Math.max(t.left,s.left),right:Math.max(t.right,s.right)}},{top:0,bottom:0,left:0,right:0});Fh.Wg(this.jr,this.Vg,this.uiScale.ni(),this.zn,i);const s=p(this.ai.x.bt()+i.left,this.ai.y.bt()+i.bottom,this.ai.x.wt()-i.right,this.ai.y.wt()-i.top);return this.nx.pm(s),this.Dm.ir(!1,[],void 0,{explicitTarget:this.Mx}),this.zs.forEach(t=>t.ir(e,this.zn)),this}dispose(){return this.nx.G(),this.Dm.G(),wh(this.ai),super.dispose()}Y(){return super.Y(),this.ai.Y(),this}H(){return super.H(),this.ai.H(),this}Ys(){return Me(this.getFillStyle(),this.lx._i())}er(){return{fill:this.getFillStyle()}}addEventListener(t,e,i){this.D.addEventListener(t,e,i)}removeEventListener(t,e){this.D.removeEventListener(t,e)}}const Jl=(t,e)=>{const i=t>0,s=e>0;return`${[Te(Math.abs(0|t),2),"° ",Te(Math.abs(0|(t<0?t=-t:t)%1*60),2),"' "].join("")+(i?"E":"W")}, ${[Te(Math.abs(0|e),2),"° ",Te(Math.abs(0|(e<0?e=-e:e)%1*60),2),"' "].join("")+(s?"N":"S")}`},tu=(t,e,i)=>{var s;const r=[[{text:e.region.name,rowFillStyle:t.getTheme().cursorResultTableHeaderBackgroundFillStyle}],[Jl(e.longitude,e.latitude)]];return void 0!==e.value&&r.push({text:ms(e.lut?$i(e.lut,e.value):e.value.toFixed(2),null===(s=e.lut)||void 0===s?void 0:s.units),font:{weight:"bold"}}),r};class eu extends En{constructor(t,e,i,s,r,n,o,a,h){super(t,e,e.wx(i),s,r,{numeric:e._x({amplitude:s.polarAmplitudeAxisNumericTicks,radial:s.polarAmplitudeAxisNumericTicks}),datetime:e._x({amplitude:s.polarAmplitudeAxisDateTimeTicks,radial:s.polarAmplitudeAxisDateTimeTicks}),time:e._x({amplitude:s.polarAmplitudeAxisTimeTicks,radial:s.polarAmplitudeAxisTimeTicks})},{type:"linear"}),this.D=new pt,this.kx=n,this.Cx=o,this.Tx=a,this.ys=h,this.Fx=i,this.Ix=e._x({amplitude:s.polarAmplitudeAxisStrokeStyle,radial:s.polarRadialAxisStrokeStyle}),this.Jr=a.bn(i).setPointerEvents(!1).wh(e._x({amplitude:s.polarAmplitudeAxisTitleFont,radial:s.polarRadialAxisTitleFont})).qe(e._x({amplitude:s.polarAmplitudeAxisTitleFillStyle,radial:s.polarRadialAxisTitleFillStyle})),this.Ch=this.ys.sA([this.Jr]).Bs(s.effectsText)}setTickStrategy(t,e){return super.dh(t,e)}setStrokeStyle(t){return this.Ix="function"==typeof t?t(this.Ix):t,this.Cx.Ds(),this}getStrokeStyle(){return this.Ix}Gh(t){return{}}Yh(t,e,i,s){const r=this.Px(this.Fx,t,e.Fr);return{keyValue:t,tickLevel:e,labelText:i,labelPosition:Ei(this.Lx(this.Fx,t),r.padding),labelAlignment:r.alignment,labelRotation:r.rotation,labelOffset:r.offset}}Kh(t,e,i,s){return new iu(e,t,this.Fx,this.Tx,this.Bx(this.kx,this.Fx),this.Tx.dr(this.Fx).setPointerEvents(!1))}Kr(){return this.Fx}ir(t){this.Dx(this.Fx,this.Ix,t.dA),this.Rx(this.Fx,this.Jr,t.dA),t.ticksInfo.forEach((t,e)=>{e.Rh.sr(t.labelPosition).Yl(t.labelAlignment)._h(t.labelRotation).zl(t.labelOffset.x,t.labelOffset.y),this.Ex&&!1===this.Ex(e)&&e.Rh.setVisible(!1),this.Ox(this.Fx,e.zx,e.Vx,e)})}addEventListener(t,e,i){this.D.addEventListener(t,e,i)}removeEventListener(t,e){this.D.removeEventListener(t,e)}setPointerEvents(t){return this.D.setPointerEvents(t),this}getPointerEvents(){return this.D.getPointerEvents()}}class iu extends Mn{constructor(t,e,i,s,r,n,o){super(t,e,s,i,o),this.zx=r,this.Vx=n,r.setPointerEvents(!1),this.ps.push(r,n)}}class su extends eu{constructor(t,e,i,s,r,n,o,a,h){super(t,ru(()=>this.lA()),e,i,s,r,n,o,a),this.Ip=this.Cx.dr(this.Fx).setPointerEvents(!1),this.Nx=h,this.setScrollStrategy(an.expansion),this.setTickStrategy(hn.Numeric),this.setTitle("Amplitude"),this.Jr.Jh(i.polarAmplitudeAxisTitleShadow)}lA(){return this.Nx()}Xh(t,e,i){return{ticksInfo:e,dA:this.hn((t,e)=>{const i=e.Mn.Fr,s=.5*this.Ix.getThickness()+i.tickLength+i.tickPadding+Math.abs(e.Rh.Oh().vu().y);return Math.max(t,s)},0),updatedTicks:i}}An(t,e){return xs(t,e,this.Fx.y)}vn(t,e,i){const s=2*Math.abs(e-t),r=this.Fx.x.Jt(s);return{start:t+i.start*r*Math.sign(t-e),end:e+i.end*r*Math.sign(e-t)}}Lx(t,e){return{x:t.ue()?e-t.ce().start:t.ce().start-e,y:0}}Bx(t,e){return t.xd(e)}Ox(t,e,i,s){const r=s.Mn.Fr,n=t.ue()?s.M-t.ce().start:t.ce().start-s.M;Yt(s.M,t.ce().start)||Yt(s.M,t.ce().end)?e.setVisible(!1):e.setVisible(!0).Jc(0).Ar(360).iu(void 0).tu(0).Qc(n).iu(60).qe(Ki).Ke(r.gridStrokeStyle);const o=.5*this.Ix.getThickness();i.gr({x:n,y:-o*t.ni().y}).Ar({x:n,y:-(o+r.tickLength)*t.ni().y}).ur(r.tickStyle)}Px(t,e,i){return{alignment:{x:0,y:1},padding:{x:0,y:t.ni().y*-(.5*this.Ix.getThickness()+i.tickLength+i.tickPadding)},rotation:0,offset:{x:0,y:0}}}Dx(t,e,i){const s=t.ue()?t.ce().end-t.ce().start:t.ce().start-t.ce().end;this.Ip.gr({x:0,y:0}).Ar({x:s,y:0}).ur(e)}Rx(t,e,i){const s=t.ue()?(t.ce().start+t.ce().end)/2-t.ce().start:t.ce().start-(t.ce().start+t.ce().end)/2;e.Yl({x:0,y:1}).sr({x:s,y:-i*t.ni().y})}}const ru=t=>({...Gh(t,t=>t.getAmplitudeMin(),t=>t.getAmplitudeMax(),t=>{}),wx:t=>({getInnerStart:()=>t.ce().start,getInnerEnd:()=>t.ce().end,W:(e,i)=>t.ae(e,i),et:(e,i,s,r,n)=>t.y.et(e,i,s,r,n)}),_x:t=>t.amplitude});class nu{constructor(t,e,i,s){this.Gx=!1,this.D=new pt,this.As=t,this.$x=e,this.hv=i,this.bu=s}setGeometry(t){return this.Ux=t,this.Gx=!0,this.As.pi.Ds(),this}getGeometry(){return this.Ux}setPointerEvents(t){return this.bu.setPointerEvents(t),this}dispose(){return this.bu.dispose(),this.$x(this),this.D.R("dispose",{}),this}setVisible(t){const e=this.bu.getVisible()!==t;return this.bu.setVisible(t),e&&this.D.R("visiblechange",{isVisible:t}),this.As.pi.Ds(),this}getVisible(){return this.bu.getVisible()}addEventListener(t,e,i){this.D.addEventListener(t,e,i)}removeEventListener(t,e){this.D.removeEventListener(t,e)}}class ou extends bs{constructor(){super(...arguments),this.Jg=!0,this.Zg=!0}setAutoScrollingEnabled(t){return this.Jg=t,this.As.pi.Ds(),this}getAutoScrollingEnabled(){return this.Jg}ep(){}ir(){}rp(){}setCursorEnabled(t){return this.Zg=t,this}getCursorEnabled(){return this.Zg}tp(){return this.getVisible()&&this.getCursorEnabled()}setCursorFormattingOverride(t){return this.qg=t,this}getCursorFormattingOverride(){return this.qg}}class au extends ou{constructor(t,e,i,s,r,n){super(e,i,r,n),this.Xs=t,this.As=e,this.scale=s}getAmplitudeMin(){return this.jx?this.jx.min:void 0}getAmplitudeMax(){return this.jx?this.jx.max:void 0}}const hu=(t,e)=>{const i=[],s=e.ce().start,r=e.ce().end,n=e.ue(),o=e.fe()?1:-1,a=e.ge(),h=Math.abs(r-s),l=Math.min(s,r)+.001*h,u=Math.max(s,r)-.001*h;for(const e of t){const t=Xt(e.amplitude,l,u),r=e.angle*Math.PI/180-a,h=Math.cos(r*o)*(n?t-s:s-t),c=Math.sin(r*o)*(n?t-s:s-t),d=e.color;i.push({x:h,y:c,color:d})}return i},lu=t=>{const e={min:Ke,max:qe};for(const i of t)e.min=Math.min(e.min,i.amplitude),e.max=Math.max(e.max,i.amplitude);return e},uu=t=>t.slice().map(t=>t.angle>=0&&t.angle<=360?t:{...t,angle:t.angle%360}),cu=(t,e)=>{let i=Fi(t);for(e.fe()||(i*=-1),i+=180*e.ge()/Math.PI;i<0;)i+=360;i%=360;const s=Si(t),r=e.ce(),n=Math.abs(r.end-r.start);return{angle:i,amplitude:ws(r.start,r.end,s/n)}};class du extends au{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,o),this.Os="Polygon Series",this.Yx=[],this.Hx=[],this.Wx=t=>{const e=this.Hx.indexOf(t);e>=0&&this.Hx.splice(e,1);const i=this.Yx.findIndex(e=>e===t.bu);i>=0&&this.Yx.splice(i,1),this.Xs.Ds()},this.D=new pt,this.Ze=ke(this.bi.polarPolygonSeriesFillStyle,n),this.Je=ke(this.bi.polarPolygonSeriesStrokeStyle,n)}solveNearest(t,e){const i=this.As.pi.Qa(t),s={x:i.engineX,y:i.engineY},r=ds(s,this.Yx,(t,e)=>{const i=t.fd(e);if(i)return K(i,this.scale,t.pi.ai)},hi);if(!r)return;const n=K(r[0],r[1].pi.ai,this.scale);if(!this.Xx(r[1]))return;const o=cu(n,this.scale);return{cursorPosition:{pointMarker:n,pointMarkerScale:this.scale,resultTable:n,resultTableScale:this.scale},series:this,...o}}Qi(t,e,i){return Ye({series:this},{cursorPosition:0,amplitude:0,angle:0,color:0},()=>this.solveNearest(e,this.As.getCursorMode()))}addPolygon(){const t=new nu(this.As,this.Wx,this,this.Zx());return this.Hx.push(t),t}setFillStyle(t){this.Ze="function"==typeof t?t(this.Ze):t;const e=this.Ze;for(const t of this.Yx)t.qe(e);return this.Xs.Ds(),this}getFillStyle(){return this.Ze}setStrokeStyle(t){this.Je="function"==typeof t?t(this.Je):t;const e=this.Je;for(const t of this.Yx)t.Ke(e);return this.Xs.Ds(),this}getStrokeStyle(){return this.Je}dp(){return this.Jg&&void 0!==this.Hx.find(t=>void 0!==t.Jx)&&this.getVisible()}ir(){this.Hx.forEach(t=>{(t.Gx||this.scale.pe())&&t.Qx&&(t.bu.nc(hu(t.Qx,this.scale)),t.Gx=!1,t.bu.Oh())})}ep(){super.ep();const t=g(Ke,qe);this.Hx.forEach(e=>{if(!e.Ux)return;const i=!e.Gx&&e.Qx?e.Qx:uu(e.Ux);e.Qx=i;const s=!e.Gx&&e.Jx?e.Jx:lu(i);e.Jx=s,t.min=Math.min(t.min,s.min),t.max=Math.max(t.max,s.max)}),this.jx=t}rr(t,e){t.Ii(e),this.Xs.Ds()}er(){return{fill:this.Ze,stroke:this.Je}}Zx(){const t=this.Xs.Mu(this.scale,mo.Simple).qe(this.Ze).Ke(this.Je).Ii(this.getHighlight());return this.Yx.push(t),this.ks(t),t}Xx(t){return this.Hx.find(e=>e.bu===t)}addEventListener(t,e,i){this.D.addEventListener(t,e,i)}removeEventListener(t,e){this.D.removeEventListener(t,e)}}class fu extends au{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,o),this.Os="Area Series",this.Kx=[],this.qx=!1,this.tS=!1,this.iS=!1,this.D=new pt,this.Ze=ke(this.bi.polarAreaSeriesFillStyle,n),this.Je=ke(this.bi.polarAreaSeriesStrokeStyle,n)}setData(t){0!==this.Kx.length&&this.As.pi.Ca(_n.Bo);const e=(t=>{const e=[];let i,s,r=!1;for(let n=0;nthis.rM[t]);return void 0===i?i=e