/**
 * Highcharts JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/data-sorting
 * @requires highcharts
 *
 * Data sorting module
 *
 * (c) 2025-2025 Torstein Honsi
 *
 * License: www.highcharts.com/license
 */import*as e from"../highcharts.js";var t={};t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let n=e.default;var a=t.n(n);function i(e){e.series.concat().sort((e,t)=>e.linkedSeries.length||t.linkedSeries.length?t.linkedSeries.length-e.linkedSeries.length:0).forEach(e=>{e.points||e.data||!e.enabledDataSorting||e.setData(e.options.data,!1)})}function r(e){var t;(0,n.extend)(e,{requireSorting:!1,sorted:!1,enabledDataSorting:!0,allowDG:!1}),(t=e.options).pointRange??(t.pointRange=1)}let o=a();({compose:function(e,t){(0,n.wrap)(t.prototype,"setData",function(e,t,...a){if(this.options.dataSorting?.enabled){if(!this.chart.hasInitializedLinkedSeries)return this;Array.isArray(t)&&(t=function(e,t){let{sortKey:a="y"}=e.options.dataSorting||{},i=function(e,t){return(0,n.defined)(t)&&e.pointClass.prototype.optionsToObject.call({series:e},t)||{}};return t.forEach((n,a)=>{t[a]=i(e,n),t[a].index=a}),t.concat().sort((e,t)=>{let i=(0,n.getNestedProperty)(a,e),r=(0,n.getNestedProperty)(a,t);return r<i?-1:+(r>i)}).forEach((e,t)=>{e.x=t}),e.linkedSeries&&e.linkedSeries.forEach(e=>{let n=e.options,a=n.data;!n.dataSorting?.enabled&&a&&(a.forEach((n,r)=>{a[r]=i(e,n),t[r]&&(a[r].x=t[r].x,a[r].index=r)}),e.setData(a,!1))}),t}(this,t))}return e.apply(this,[t].concat(a))}),(0,n.addEvent)(e,"beforeRender",function(){i(this)}),(0,n.addEvent)(e,"afterLinkSeries",function(){this.series.forEach(e=>{e.linkedParent?.enabledDataSorting&&r(e)}),this.hasInitializedLinkedSeries=!0}),(0,n.addEvent)(e,"afterAddSeries",function({series:e}){e.enabledDataSorting&&e.setData(e.options.data,!1)}),(0,n.addEvent)(t,"afterUpdate",function(){i(this.chart)}),(0,n.addEvent)(t,"afterInit",function(){this.options.dataSorting?.enabled&&r(this)})}}).compose(o.Chart,o.Series);let s=a();export{s as default};