(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{2871:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>ev});var r=i(5155),n=i(2115),a=i(4486);class o{push(e,t,i,r){this.steps.push({array:[...e],action:t,indices:i,sorted:Array.from(this.sortedSet).sort((e,t)=>e-t),range:null==r?void 0:r.range,meta:null==r?void 0:r.meta,comparisons:this.comparisons,writes:this.writes})}compare(e,t,i){this.comparisons++,this.push(e,"compare",[t,i])}swap(e,t,i){[e[t],e[i]]=[e[i],e[t]],this.writes+=2,this.push(e,"swap",[t,i])}overwrite(e,t,i){e[t]=i,this.writes++,this.push(e,"overwrite",[t])}markSorted(e,t){t.forEach(e=>this.sortedSet.add(e)),this.push(e,"mark-sorted",t)}isSorted(e){return this.sortedSet.has(e)}finish(e){for(let t=0;ti[a+1]&&(t.swap(i,a,a+1),n=!0);if(t.markSorted(i,[r-e-1]),!n)break}return t.finish(i),t.result()},insertion:function(e){let t=new o,i=[...e];t.push(i,"init",[]),t.markSorted(i,[0]);for(let e=1;e=0&&(t.compare(i,n,n+1),!(i[n]<=r));)i[n+1]=i[n],t.writes++,t.push(i,"shift",[n,n+1]),n--;i[n+1]=r,t.writes++,t.push(i,"overwrite",[n+1]),t.markSorted(i,[e])}return t.finish(i),t.result()},heap:function(e){let t=new o,i=[...e];t.push(i,"init",[]);let r=i.length;function n(e,r){let a=r,o=2*r+1,s=2*r+2;oi[a]&&(a=o)),si[a]&&(a=s)),a!==r&&(t.swap(i,r,a),n(e,a))}for(let e=Math.floor(r/2)-1;e>=0;e--)n(r,e);for(let e=r-1;e>0;e--)t.swap(i,0,e),t.markSorted(i,[e]),n(e,0);return t.markSorted(i,[0]),t.finish(i),t.result()},quick:function(e){let t=new o,i=[...e];return t.push(i,"init",[]),!function e(r,n){if(r=n)return;let a=Math.floor((r+n)/2);e(r,a),e(a+1,n),function(e,r,n){t.push(i,"merge-range",[],{range:[e,n],meta:{mid:r}});let a=i.slice(e,r+1),o=i.slice(r+1,n+1),s=0,l=0,d=e;for(;st))}(r,a,n)}(0,i.length-1),t.finish(i),t.result()},radix:function(e){let t=new o,i=[...e];if(t.push(i,"init",[]),0===i.length)return t.finish(i),t.result();let r=Math.max(...i);for(let e=1;Math.floor(r/e)>0;e*=10){let r=Array(i.length).fill(0),n=Array(10).fill(0);t.push(i,"gap-set",[],{meta:{digit:e}});for(let r=0;r=0;t--){let a=Math.floor(i[t]/e)%10;r[n[a]-1]=i[t],n[a]--}for(let n=0;n=0;e--)a[n[i[e]-r]-1]=i[e],n[i[e]-r]--;for(let e=0;e[]);for(let e=0;ee-t),t.push(i,"bucket-sorted",[],{meta:{bucket:e}});let a=0;for(let e=0;e0;e=Math.floor(e/2)){t.push(i,"gap-set",[],{meta:{gap:e}});for(let n=e;n=e&&(t.compare(i,a-e,a),!(i[a-e]<=r));)i[a]=i[a-e],t.writes++,t.push(i,"shift",[a-e,a],{meta:{gap:e}}),a-=e;i[a]=r,t.writes++,t.push(i,"overwrite",[a],{meta:{gap:e}})}}return t.finish(i),t.result()}},l={bubble:{en:{title:"Bubble Sort",timeComplexity:"Time: O(n^2)",spaceComplexity:"Space: O(1)",description:"Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted."},fr:{title:"Bubble Sort",timeComplexity:"Temps : O(n^2)",spaceComplexity:"Espace : O(1)",description:"Le tri \xe0 bulles est un algorithme de tri simple qui parcourt \xe0 plusieurs reprises la liste, compare les \xe9l\xe9ments adjacents et les \xe9change s'ils sont dans le mauvais ordre. Le passage \xe0 travers la liste est r\xe9p\xe9t\xe9 jusqu'\xe0 ce que la liste soit tri\xe9e."},it:{title:"Bubble Sort",timeComplexity:"Tempo: O(n^2)",spaceComplexity:"Spazio: O(1)",description:"Il bubble sort \xe8 un algoritmo di ordinamento semplice che scorre ripetutamente la lista, confronta gli elementi adiacenti e li scambia se sono nell'ordine sbagliato. Il passaggio attraverso la lista viene ripetuto fino a quando la lista non \xe8 ordinata."},de:{title:"Bubble Sort",timeComplexity:"Zeit: O(n^2)",spaceComplexity:"Platz: O(1)",description:"Bubble Sort ist ein einfacher Sortieralgorithmus, der wiederholt durch die Liste geht, benachbarte Elemente vergleicht und sie vertauscht, wenn sie in der falschen Reihenfolge sind. Der Durchgang durch die Liste wird wiederholt, bis die Liste sortiert ist."},es:{title:"Bubble Sort",timeComplexity:"Tiempo: O(n^2)",spaceComplexity:"Espacio: O(1)",description:"El ordenamiento de burbuja es un algoritmo de ordenamiento simple que recorre repetidamente la lista, compara los elementos adyacentes y los intercambia si est\xe1n en el orden incorrecto. El recorrido a trav\xe9s de la lista se repite hasta que la lista est\xe1 ordenada."},ja:{title:"Bubble Sort",timeComplexity:"時間: O(n^2)",spaceComplexity:"空間: O(1)",description:"バブルソートは、リストを繰り返しステップして、隣接する要素を比較し、それらが間違った順序にある場合に入れ替える単純なソートアルゴリズムです。リストを通過する操作はリストがソートされるまで繰り返されます。"},no:{title:"Bubble Sort",timeComplexity:"Tid: O(n^2)",spaceComplexity:"Plass: O(1)",description:"Bubble sort er en enkel sorteringsalgoritme som gjentatte ganger g\xe5r gjennom listen, sammenligner tilst\xf8tende elementer og bytter dem hvis de er i feil rekkef\xf8lge. Gjennomgangen av listen gjentas til listen er sortert."},sv:{title:"Bubble Sort",timeComplexity:"Tid: O(n^2)",spaceComplexity:"Utrymme: O(1)",description:"Bubble sort \xe4r en enkel sorteringsalgoritm som upprepade g\xe5nger g\xe5r igenom listan, j\xe4mf\xf6r intilliggande element och byter dem om de \xe4r i fel ordning. Genomg\xe5ngen av listan upprepas tills listan \xe4r sorterad."},ua:{title:"Bubble Sort",timeComplexity:"Час: O(n^2)",spaceComplexity:"Місце: O(1)",description:"Сортування бульбашкою - це простий алгоритм сортування, який повторно проходить по списку, порівнює суміжні елементи та змінює їх місцями, якщо вони знаходяться в неправильному порядку. Прохід по списку повторюється до тих пір, поки список не буде відсортований."},ru:{title:"Bubble Sort",timeComplexity:"Время: O(n^2)",spaceComplexity:"Место: O(1)",description:"Сортировка пузырьком - это простой алгоритм сортировки, который многократно проходит по списку, сравнивает смежные элементы и меняет их местами, если они находятся в неправильном порядке. Проход по списку повторяется до тех пор, пока список не будет отсортирован."}},insertion:{en:{title:"Insertion Sort",timeComplexity:"Time: O(n^2)",spaceComplexity:"Space: O(1)",description:"Insertion sort is a simple sorting algorithm that builds the final sorted array one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort."},fr:{title:"Insertion Sort",timeComplexity:"Temps : O(n^2)",spaceComplexity:"Espace : O(1)",description:"Le tri par insertion est un algorithme de tri simple qui construit le tableau tri\xe9 final un \xe9l\xe9ment \xe0 la fois. Il est beaucoup moins efficace sur les grandes listes que des algorithmes plus avanc\xe9s comme le tri rapide, le tri par tas ou le tri fusion."},it:{title:"Insertion Sort",timeComplexity:"Tempo: O(n^2)",spaceComplexity:"Spazio: O(1)",description:"L'insertion sort \xe8 un algoritmo di ordinamento semplice che costruisce l'array ordinato finale un elemento alla volta. \xc8 molto meno efficiente su grandi liste rispetto ad algoritmi pi\xf9 avanzati come il quicksort, l'heapsort o il merge sort."},de:{title:"Insertion Sort",timeComplexity:"Zeit: O(n^2)",spaceComplexity:"Platz: O(1)",description:"Insertion Sort ist ein einfacher Sortieralgorithmus, der das endg\xfcltig sortierte Array ein Element nach dem anderen aufbaut. Es ist viel weniger effizient bei gro\xdfen Listen als fortschrittlichere Algorithmen wie Quicksort, Heapsort oder Mergesort."},es:{title:"Insertion Sort",timeComplexity:"Tiempo: O(n^2)",spaceComplexity:"Espacio: O(1)",description:"El ordenamiento por inserci\xf3n es un algoritmo de ordenamiento simple que construye la matriz ordenada final un elemento a la vez. Es mucho menos eficiente en listas grandes que algoritmos m\xe1s avanzados como el quicksort, el heapsort o el mergesort."},ja:{title:"Insertion Sort",timeComplexity:"時間: O(n^2)",spaceComplexity:"空間: O(1)",description:"挿入ソートは、最終的にソートされた配列を一度に1つの項目ずつ構築する単純なソートアルゴリズムです。クイックソート、ヒープソート、マージソートなどの高度なアルゴリズムよりも大きなリストでは効率が大幅に低下します。"},no:{title:"Insertion Sort",timeComplexity:"Tid: O(n^2)",spaceComplexity:"Plass: O(1)",description:"Insertion sort er en enkel sorteringsalgoritme som bygger den endelige sorterte matrisen ett element om gangen. Det er mye mindre effektivt p\xe5 store lister enn mer avanserte algoritmer som quicksort, heapsort eller mergesort."},sv:{title:"Insertion Sort",timeComplexity:"Tid: O(n^2)",spaceComplexity:"Utrymme: O(1)",description:"Insertion sort \xe4r en enkel sorteringsalgoritm som bygger den slutgiltiga sorterade matrisen ett element i taget. Det \xe4r mycket mindre effektivt p\xe5 stora listor \xe4n mer avancerade algoritmer som quicksort, heapsort eller mergesort."},ua:{title:"Insertion Sort",timeComplexity:"Час: O(n^2)",spaceComplexity:"Місце: O(1)",description:"Сортування вставкою - це простий алгоритм сортування, який будує остаточно відсортований масив по одному елементу за раз. Він набагато менш ефективний на великих списках, ніж більш просунуті алгоритми, такі як швидке сортування, сортування купою або сортування злиттям."},ru:{title:"Insertion Sort",timeComplexity:"Время: O(n^2)",spaceComplexity:"Место: O(1)",description:"Сортировка вставками - это простой алгоритм сортировки, который строит окончательно отсортированный массив по одному элементу за раз. Он гораздо менее эффективен на больших списках, чем более продвинутые алгоритмы, такие как быстрая сортировка, сортировка кучей или сортировка слиянием."}},merge:{en:{title:"Merge Sort",timeComplexity:"Time: O(n log n)",spaceComplexity:"Space: O(n)",description:"Merge sort is an efficient, stable, and comparison-based sorting algorithm. Most implementations produce a stable sort, meaning that the order of equal elements is the same in the input and output. It works by recursively splitting the list into two halves, sorting each half, and then merging the sorted halves back together."},fr:{title:"Merge Sort",timeComplexity:"Temps : O(n log n)",spaceComplexity:"Espace : O(n)",description:"Le tri fusion est un algorithme de tri efficace, stable et bas\xe9 sur la comparaison. La plupart des impl\xe9mentations produisent un tri stable, ce qui signifie que l'ordre des \xe9l\xe9ments \xe9gaux est le m\xeame dans l'entr\xe9e et la sortie. Il fonctionne en divisant r\xe9cursivement la liste en deux moiti\xe9s, en triant chaque moiti\xe9, puis en fusionnant les moiti\xe9s tri\xe9es."},it:{title:"Merge Sort",timeComplexity:"Tempo: O(n log n)",spaceComplexity:"Spazio: O(n)",description:"Il merge sort \xe8 un algoritmo di ordinamento efficiente, stabile e basato sul confronto. La maggior parte delle implementazioni produce un ordinamento stabile, il che significa che l'ordine degli elementi uguali \xe8 lo stesso nell'input e nell'output. Funziona dividendo ricorsivamente la lista in due met\xe0, ordinando ciascuna met\xe0 e poi unendo le met\xe0 ordinate."},de:{title:"Merge Sort",timeComplexity:"Zeit: O(n log n)",spaceComplexity:"Platz: O(n)",description:"Mergesort ist ein effizienter, stabiler und vergleichsbasierter Sortieralgorithmus. Die meisten Implementierungen produzieren eine stabile Sortierung, was bedeutet, dass die Reihenfolge der gleichen Elemente im Eingabedaten und Ausgabedaten gleich ist. Es funktioniert, indem die Liste rekursiv in zwei H\xe4lften geteilt wird, jede H\xe4lfte sortiert und dann die sortierten H\xe4lften wieder zusammengef\xfchrt werden."},es:{title:"Merge Sort",timeComplexity:"Tiempo: O(n log n)",spaceComplexity:"Espacio: O(n)",description:"El mergesort es un algoritmo de ordenamiento eficiente, estable y basado en comparaciones. La mayor\xeda de las implementaciones producen un ordenamiento estable, lo que significa que el orden de los elementos iguales es el mismo en la entrada y en la salida. Funciona dividiendo recursivamente la lista en dos mitades, ordenando cada mitad y luego fusionando las mitades ordenadas."},ja:{title:"Merge Sort",timeComplexity:"時間: O(n log n)",spaceComplexity:"空間: O(n)",description:"マージソートは、効率的で安定した比較ベースのソートアルゴリズムです。ほとんどの実装は安定したソートを生成し、入力と出力で同じ要素の順序が同じになります。リストを再帰的に2つの半分に分割し、それぞれをソートしてからソートされた半分を再度マージすることで動作します。"},no:{title:"Merge Sort",timeComplexity:"Tid: O(n log n)",spaceComplexity:"Plass: O(n)",description:"Merge sort er en effektiv, stabil og sammenligningsbasert sorteringsalgoritme. De fleste implementeringer produserer en stabil sortering, noe som betyr at rekkef\xf8lgen av like elementer er den samme i inn- og utdata. Den fungerer ved \xe5 rekursivt dele listen i to halvdeler, sortere hver halv og deretter sl\xe5 de sorterte halvdelene sammen igjen."},sv:{title:"Merge Sort",timeComplexity:"Tid: O(n log n)",spaceComplexity:"Utrymme: O(n)",description:"Merge sort \xe4r en effektiv, stabil och j\xe4mf\xf6relsebaserad sorteringsalgoritm. De flesta implementationer producerar en stabil sortering, vilket betyder att ordningen p\xe5 lika element \xe4r densamma i input och output. Det fungerar genom att rekursivt dela upp listan i tv\xe5 halvor, sortera varje halv och sedan sl\xe5 ihop de sorterade halvorna."},ua:{title:"Merge Sort",timeComplexity:"Час: O(n log n)",spaceComplexity:"Місце: O(n)",description:"Сортування злиттям - це ефективний, стабільний алгоритм сортування на основі порівнянь. Більшість реалізацій забезпечують стабільне сортування, що означає, що порядок однакових елементів однаковий на вході та на виході. Він працює, рекурсивно розділяючи список на дві половини, сортує кожну половину, а потім зливає відсортовані половини разом."},ru:{title:"Merge Sort",timeComplexity:"Время: O(n log n)",spaceComplexity:"Место: O(n)",description:"Сортировка слиянием - это эффективный, стабильный и основанный на сравнениях алгоритм сортировки. Большинство реализаций обеспечивают стабильную сортировку, что означает, что порядок одинаковых элементов на входе и на выходе одинаков. Он работает, рекурсивно разделяя список на две половины, сортируя каждую половину, а затем объединяя отсортированные половины вместе."}},heap:{en:{title:"Heap Sort",timeComplexity:"Time: O(n log n)",spaceComplexity:"Space: O(1)",description:"Heap sort is a comparison-based sorting algorithm that uses a binary heap data structure. It divides its input into a sorted and an unsorted region, and it iteratively shrinks the unsorted region by extracting the largest element and moving it to the sorted region."},fr:{title:"Heap Sort",timeComplexity:"Temps : O(n log n)",spaceComplexity:"Espace : O(1)",description:"Le tri par tas est un algorithme de tri bas\xe9 sur la comparaison qui utilise une structure de donn\xe9es de tas binaire. Il divise son entr\xe9e en une r\xe9gion tri\xe9e et une r\xe9gion non tri\xe9e, et il r\xe9duit de mani\xe8re it\xe9rative la r\xe9gion non tri\xe9e en extrayant le plus grand \xe9l\xe9ment et en le d\xe9pla\xe7ant vers la r\xe9gion tri\xe9e."},it:{title:"Heap Sort",timeComplexity:"Tempo: O(n log n)",spaceComplexity:"Spazio: O(1)",description:"L'heapsort \xe8 un algoritmo di ordinamento basato sul confronto che utilizza una struttura dati heap binaria. Divide il suo input in una regione ordinata e una non ordinata e riduce iterativamente la regione non ordinata estraendo l'elemento pi\xf9 grande e spostandolo nella regione ordinata."},de:{title:"Heap Sort",timeComplexity:"Zeit: O(n log n)",spaceComplexity:"Platz: O(1)",description:"Heapsort ist ein vergleichsbasierter Sortieralgorithmus, der eine bin\xe4re Heap-Datenstruktur verwendet. Es teilt seine Eingabe in einen sortierten und einen unsortierten Bereich und verkleinert den unsortierten Bereich iterativ, indem das gr\xf6\xdfte Element extrahiert und in den sortierten Bereich verschoben wird."},es:{title:"Heap Sort",timeComplexity:"Tiempo: O(n log n)",spaceComplexity:"Espacio: O(1)",description:"El heapsort es un algoritmo de ordenamiento basado en comparaciones que utiliza una estructura de datos de mont\xf3n binario. Divide su entrada en una regi\xf3n ordenada y una no ordenada, y reduce iterativamente la regi\xf3n no ordenada extrayendo el elemento m\xe1s grande y movi\xe9ndolo a la regi\xf3n ordenada."},ja:{title:"Heap Sort",timeComplexity:"時間: O(n log n)",spaceComplexity:"空間: O(1)",description:"ヒープソートは、バイナリヒープデータ構造を使用する比較ベースのソートアルゴリズムです。入力をソート済みと未ソートの領域に分割し、最も大きな要素を抽出してソート済み領域に移動することで未ソート領域を反復的に縮小します。"},no:{title:"Heap Sort",timeComplexity:"Tid: O(n log n)",spaceComplexity:"Plass: O(1)",description:"Heap sort er en sammenligningsbasert sorteringsalgoritme som bruker en bin\xe6r heap-datastruktur. Den deler inn dataene i et sortert og et usortert omr\xe5de, og krymper det usorterte omr\xe5det iterativt ved \xe5 trekke ut det st\xf8rste elementet og flytte det til det sorterte omr\xe5det."},sv:{title:"Heap Sort",timeComplexity:"Tid: O(n log n)",spaceComplexity:"Utrymme: O(1)",description:"Heap sort \xe4r en j\xe4mf\xf6relsebaserad sorteringsalgoritm som anv\xe4nder en bin\xe4r heap-datastruktur. Den delar upp sin input i en sorterad och en osorterad region, och krymper iterativt den osorterade regionen genom att extrahera det st\xf6rsta elementet och flytta det till den sorterade regionen."},ua:{title:"Heap Sort",timeComplexity:"Час: O(n log n)",spaceComplexity:"Місце: O(1)",description:"Сортування купою - це алгоритм сортування на основі порівнянь, який використовує структуру даних бінарної купи. Він ділить свій вхід на відсортовану та невідсортовану область і ітеративно зменшує невідсортовану область, витягуючи найбільший елемент і переміщуючи його до відсортованої області."},ru:{title:"Heap Sort",timeComplexity:"Время: O(n log n)",spaceComplexity:"Место: O(1)",description:"Сортировка кучей - это алгоритм сортировки на основе сравнений, который использует структуру данных бинарной кучи. Он делит свой вход на отсортированную и неотсортированную область и итеративно сокращает неотсортированную область, извлекая наибольший элемент и перемещая его в отсортированную область."}},quick:{en:{title:"Quick Sort",timeComplexity:"Time: O(n log n) on average, O(n^2) in the worst case",spaceComplexity:"Space: O(log n)",description:"Quick sort is an efficient sorting algorithm that uses a divide-and-conquer approach to sort elements. It works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays according to whether they are less than or greater than the pivot. The sub-arrays are then sorted recursively."},fr:{title:"Quick Sort",timeComplexity:"Temps : O(n log n) en moyenne, O(n^2) dans le pire des cas",spaceComplexity:"Espace : O(log n)",description:"Le tri rapide est un algorithme de tri efficace qui utilise une approche de diviser pour mieux r\xe9gner pour trier les \xe9l\xe9ments. Il fonctionne en s\xe9lectionnant un \xe9l\xe9ment 'pivot' dans le tableau et en partitionnant les autres \xe9l\xe9ments en deux sous-tableaux selon qu'ils sont inf\xe9rieurs ou sup\xe9rieurs au pivot. Les sous-tableaux sont ensuite tri\xe9s de mani\xe8re r\xe9cursive."},it:{title:"Quick Sort",timeComplexity:"Tempo: O(n log n) in media, O(n^2) nel peggiore dei casi",spaceComplexity:"Spazio: O(log n)",description:"Il quick sort \xe8 un algoritmo di ordinamento efficiente che utilizza un approccio divide et impera per ordinare gli elementi. Funziona selezionando un elemento 'pivot' dall'array e partizionando gli altri elementi in due sotto-array a seconda che siano inferiori o superiori al pivot. I sotto-array vengono poi ordinati ricorsivamente."},de:{title:"Quick Sort",timeComplexity:"Zeit: O(n log n) im Durchschnitt, O(n^2) im schlimmsten Fall",spaceComplexity:"Platz: O(log n)",description:"Quicksort ist ein effizienter Sortieralgorithmus, der einen Divide-and-Conquer-Ansatz verwendet, um Elemente zu sortieren. Es funktioniert, indem ein 'Pivot'-Element aus dem Array ausgew\xe4hlt und die anderen Elemente in zwei Unterarrays partitioniert werden, je nachdem, ob sie kleiner oder gr\xf6\xdfer als das Pivot sind. Die Unterarrays werden dann rekursiv sortiert."},es:{title:"Quick Sort",timeComplexity:"Tiempo: O(n log n) en promedio, O(n^2) en el peor de los casos",spaceComplexity:"Espacio: O(log n)",description:"El quicksort es un algoritmo de ordenamiento eficiente que utiliza un enfoque de divide y vencer\xe1s para ordenar los elementos. Funciona seleccionando un elemento 'pivote' del array y particionando los otros elementos en dos sub-arrays seg\xfan si son menores o mayores que el pivote. Los sub-arrays se ordenan luego recursivamente."},ja:{title:"Quick Sort",timeComplexity:"時間: 平均O(n log n)、最悪O(n^2)",spaceComplexity:"空間: O(log n)",description:"クイックソートは、要素をソートするために分割統治法を使用する効率的なソートアルゴリズムです。配列から「ピボット」要素を選択し、他の要素をピボットより小さいか大きいかによって2つのサブ配列に分割することで機能します。サブ配列は再帰的にソートされます。"},no:{title:"Quick Sort",timeComplexity:"Tid: O(n log n) i gjennomsnitt, O(n^2) i verste fall",spaceComplexity:"Plass: O(log n)",description:"Quick sort er en effektiv sorteringsalgoritme som bruker en del og hersk-tiln\xe6rming for \xe5 sortere elementer. Den fungerer ved \xe5 velge et 'pivot'-element fra matrisen og partisjonere de andre elementene i to underarrayer i henhold til om de er mindre enn eller st\xf8rre enn pivot. Underarrayene sorteres deretter rekursivt."},sv:{title:"Quick Sort",timeComplexity:"Tid: O(n log n) i genomsnitt, O(n^2) i v\xe4rsta fall",spaceComplexity:"Utrymme: O(log n)",description:"Quick sort \xe4r en effektiv sorteringsalgoritm som anv\xe4nder en dela-och-h\xe4rska-metod f\xf6r att sortera element. Det fungerar genom att v\xe4lja ett 'pivot'-element fr\xe5n matrisen och partitionera de andra elementen i tv\xe5 underarrayer beroende p\xe5 om de \xe4r mindre \xe4n eller st\xf6rre \xe4n pivot. Underarrayerna sorteras sedan rekursivt."},ua:{title:"Quick Sort",timeComplexity:"Час: O(n log n) в середньому, O(n^2) в гіршому випадку",spaceComplexity:"Місце: O(log n)",description:"Швидке сортування - це ефективний алгоритм сортування, який використовує підхід поділу і завоювання для сортування елементів. Він працює, вибираючи 'опорний' елемент з масиву і розділяючи інші елементи на два підмасиви відповідно до того, чи менші вони або більші за опорний. Підмасиви потім сортуються рекурсивно."},ru:{title:"Quick Sort",timeComplexity:"Время: O(n log n) в среднем, O(n^2) в худшем случае",spaceComplexity:"Место: O(log n)",description:"Быстрая сортировка - это эффективный алгоритм сортировки, который использует подход разделяй и властвуй для сортировки элементов. Он работает, выбирая 'опорный' элемент из массива и разделяя другие элементы на два подмассива в зависимости от того, меньше они или больше опорного. Подмассивы затем сортируются рекурсивно."}},radix:{en:{title:"Radix Sort",timeComplexity:"Time: O(nk) where n is the number of elements and k is the number of digits in the largest number",spaceComplexity:"Space: O(n + k)",description:"Radix Sort is a non-comparative sorting algorithm that sorts integers by processing individual digits. It processes each digit from the least significant to the most significant, using a stable counting sort to sort digits at each level."},fr:{title:"Tri Radix",timeComplexity:"Temps : O(nk) o\xf9 n est le nombre d'\xe9l\xe9ments et k est le nombre de chiffres du plus grand nombre",spaceComplexity:"Espace : O(n + k)",description:"Le tri Radix est un algorithme de tri non comparatif qui trie les entiers en traitant les chiffres individuels. Il traite chaque chiffre du moins significatif au plus significatif, en utilisant un tri comptant stable pour trier les chiffres \xe0 chaque niveau."},it:{title:"Radix Sort",timeComplexity:"Tempo: O(nk) dove n \xe8 il numero di elementi e k \xe8 il numero di cifre nel numero pi\xf9 grande",spaceComplexity:"Spazio: O(n + k)",description:"Il Radix Sort \xe8 un algoritmo di ordinamento non comparativo che ordina gli interi elaborando le singole cifre. Elabora ciascuna cifra dal meno significativo al pi\xf9 significativo, utilizzando un ordinamento per conteggio stabile per ordinare le cifre a ciascun livello."},de:{title:"Radix Sort",timeComplexity:"Zeit: O(nk), wobei n die Anzahl der Elemente und k die Anzahl der Ziffern der gr\xf6\xdften Zahl ist",spaceComplexity:"Platz: O(n + k)",description:"Radix Sort ist ein nicht-vergleichender Sortieralgorithmus, der Ganzzahlen durch Verarbeitung einzelner Ziffern sortiert. Er verarbeitet jede Ziffer von der am wenigsten signifikanten zur am meisten signifikanten und verwendet ein stabiles Z\xe4hlersortieren, um die Ziffern auf jeder Ebene zu sortieren."},es:{title:"Radix Sort",timeComplexity:"Tiempo: O(nk) donde n es el n\xfamero de elementos y k es el n\xfamero de d\xedgitos en el n\xfamero m\xe1s grande",spaceComplexity:"Espacio: O(n + k)",description:"El Radix Sort es un algoritmo de ordenamiento no comparativo que ordena enteros procesando d\xedgitos individuales. Procesa cada d\xedgito desde el menos significativo hasta el m\xe1s significativo, utilizando un conteo estable para ordenar los d\xedgitos en cada nivel."},ja:{title:"基数ソート",timeComplexity:"時間: O(nk) ここで n は要素数、k は最大数の桁数",spaceComplexity:"空間: O(n + k)",description:"基数ソートは、個々の数字を処理することで整数をソートする非比較ソートアルゴリズムです。各桁を最下位から最上位まで処理し、安定したカウントソートを使用して各レベルの桁をソートします。"},no:{title:"Radix Sort",timeComplexity:"Tid: O(nk) der n er antall elementer og k er antall sifre i det st\xf8rste tallet",spaceComplexity:"Plass: O(n + k)",description:"Radix Sort er en ikke-sammenlignende sorteringsalgoritme som sorterer heltall ved \xe5 behandle individuelle sifre. Den behandler hvert siffer fra minst signifikant til mest signifikant, og bruker en stabil tellesortering for \xe5 sortere sifrene p\xe5 hvert niv\xe5."},sv:{title:"Radix Sort",timeComplexity:"Tid: O(nk) d\xe4r n \xe4r antalet element och k \xe4r antalet siffror i det st\xf6rsta numret",spaceComplexity:"Utrymme: O(n + k)",description:"Radix Sort \xe4r en icke-j\xe4mf\xf6rande sorteringsalgoritm som sorterar heltal genom att bearbeta individuella siffror. Den bearbetar varje siffra fr\xe5n minst signifikant till mest signifikant, med en stabil r\xe4kningssortering f\xf6r att sortera siffrorna p\xe5 varje niv\xe5."},ua:{title:"Радикс Сортування",timeComplexity:"Час: O(nk), де n - кількість елементів, а k - кількість цифр у найбільшому числі",spaceComplexity:"Місце: O(n + k)",description:"Радикс сортування - це алгоритм сортування без порівняння, який сортує цілі числа, обробляючи окремі цифри. Він обробляє кожну цифру від найменш значущої до найбільш значущої, використовуючи стабільне підрахункове сортування для сортування цифр на кожному рівні."},ru:{title:"Поразрядная сортировка",timeComplexity:"Время: O(nk), где n - количество элементов, а k - количество цифр в наибольшем числе",spaceComplexity:"Место: O(n + k)",description:"Поразрядная сортировка - это не сравнительный алгоритм сортировки, который сортирует целые числа путем обработки отдельных цифр. Он обрабатывает каждую цифру от наименее значимой до наиболее значимой, используя стабильную сортировку подсчетом для сортировки цифр на каждом уровне."}},counting:{en:{title:"Counting Sort",timeComplexity:"Time: O(n + k) where n is the number of elements and k is the range of the input",spaceComplexity:"Space: O(k)",description:"Counting Sort is a non-comparative sorting algorithm that works by counting the number of occurrences of each distinct element in the input. The count is then used to place the elements in the correct position in the output array."},fr:{title:"Tri par d\xe9nombrement",timeComplexity:"Temps : O(n + k) o\xf9 n est le nombre d'\xe9l\xe9ments et k est la plage de l'entr\xe9e",spaceComplexity:"Espace : O(k)",description:"Le tri par d\xe9nombrement est un algorithme de tri non comparatif qui fonctionne en comptant le nombre d'occurrences de chaque \xe9l\xe9ment distinct dans l'entr\xe9e. Le compte est ensuite utilis\xe9 pour placer les \xe9l\xe9ments dans la position correcte dans le tableau de sortie."},it:{title:"Counting Sort",timeComplexity:"Tempo: O(n + k) dove n \xe8 il numero di elementi e k \xe8 l'intervallo dell'input",spaceComplexity:"Spazio: O(k)",description:"Il Counting Sort \xe8 un algoritmo di ordinamento non comparativo che funziona contando il numero di occorrenze di ciascun elemento distinto nell'input. Il conteggio viene quindi utilizzato per posizionare gli elementi nella posizione corretta nell'array di output."},de:{title:"Counting Sort",timeComplexity:"Zeit: O(n + k), wobei n die Anzahl der Elemente und k der Bereich der Eingabe ist",spaceComplexity:"Platz: O(k)",description:"Counting Sort ist ein nicht-vergleichender Sortieralgorithmus, der funktioniert, indem die Anzahl der Vorkommen jedes einzelnen Elements in der Eingabe gez\xe4hlt wird. Die Z\xe4hlung wird dann verwendet, um die Elemente an der richtigen Position im Ausgabearray zu platzieren."},es:{title:"Counting Sort",timeComplexity:"Tiempo: O(n + k) donde n es el n\xfamero de elementos y k es el rango de la entrada",spaceComplexity:"Espacio: O(k)",description:"Counting Sort es un algoritmo de ordenamiento no comparativo que funciona contando el n\xfamero de ocurrencias de cada elemento distinto en la entrada. Luego, el conteo se utiliza para colocar los elementos en la posici\xf3n correcta en la matriz de salida."},ja:{title:"計数ソート",timeComplexity:"時間: O(n + k) ここで n は要素数、k は入力範囲",spaceComplexity:"空間: O(k)",description:"計数ソートは、入力内の各異なる要素の出現回数をカウントすることで機能する非比較ソートアルゴリズムです。次に、カウントを使用して、要素を出力配列の正しい位置に配置します。"},no:{title:"Counting Sort",timeComplexity:"Tid: O(n + k) der n er antall elementer og k er omr\xe5det for inngangen",spaceComplexity:"Plass: O(k)",description:"Counting Sort er en ikke-sammenlignende sorteringsalgoritme som fungerer ved \xe5 telle antall forekomster av hvert distinkte element i inngangen. Deretter brukes tellingen til \xe5 plassere elementene i riktig posisjon i utgangsmatrisen."},sv:{title:"Counting Sort",timeComplexity:"Tid: O(n + k) d\xe4r n \xe4r antalet element och k \xe4r inmatningsomr\xe5det",spaceComplexity:"Utrymme: O(k)",description:"Counting Sort \xe4r en icke-j\xe4mf\xf6rande sorteringsalgoritm som fungerar genom att r\xe4kna antalet f\xf6rekomster av varje distinkt element i ing\xe5ngen. Sedan anv\xe4nds r\xe4kningen f\xf6r att placera elementen i r\xe4tt position i utmatningsmatrisen."},ua:{title:"Підрахункове сортування",timeComplexity:"Час: O(n + k), де n - кількість елементів, а k - діапазон введення",spaceComplexity:"Місце: O(k)",description:"Підрахункове сортування - це алгоритм сортування без порівняння, який працює шляхом підрахунку кількості появ кожного окремого елемента у вхідних даних. Потім підрахунок використовується для розміщення елементів у правильній позиції у вихідному масиві."},ru:{title:"Сортировка подсчетом",timeComplexity:"Время: O(n + k), где n - количество элементов, а k - диапазон входных данных",spaceComplexity:"Место: O(k)",description:"Сортировка подсчетом - это не сравнительный алгоритм сортировки, который работает путем подсчета количества вхождений каждого отдельного элемента во входных данных. Затем подсчет используется для размещения элементов в правильной позиции в выходном массиве."}},bucket:{en:{title:"Bucket Sort",timeComplexity:"Time: O(n + k) where n is the number of elements and k is the number of buckets",spaceComplexity:"Space: O(n + k)",description:"Bucket Sort is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm or recursively applying the bucket sort."},fr:{title:"Tri par compartiments",timeComplexity:"Temps : O(n + k) o\xf9 n est le nombre d'\xe9l\xe9ments et k est le nombre de compartiments",spaceComplexity:"Espace : O(n + k)",description:"Le tri par compartiments est un algorithme de tri qui fonctionne en distribuant les \xe9l\xe9ments d'un tableau dans un certain nombre de compartiments. Chaque compartiment est ensuite tri\xe9 individuellement, soit en utilisant un autre algorithme de tri, soit en appliquant r\xe9cursivement le tri par compartiments."},it:{title:"Bucket Sort",timeComplexity:"Tempo: O(n + k) dove n \xe8 il numero di elementi e k \xe8 il numero di bucket",spaceComplexity:"Spazio: O(n + k)",description:"Il Bucket Sort \xe8 un algoritmo di ordinamento che funziona distribuendo gli elementi di un array in un certo numero di bucket. Ogni bucket viene quindi ordinato singolarmente, utilizzando un altro algoritmo di ordinamento o applicando ricorsivamente il bucket sort."},de:{title:"Bucket Sort",timeComplexity:"Zeit: O(n + k), wobei n die Anzahl der Elemente und k die Anzahl der Buckets ist",spaceComplexity:"Platz: O(n + k)",description:"Bucket Sort ist ein Sortieralgorithmus, der funktioniert, indem die Elemente eines Arrays auf eine Anzahl von Buckets verteilt werden. Jeder Bucket wird dann einzeln sortiert, entweder unter Verwendung eines anderen Sortieralgorithmus oder durch rekursive Anwendung des Bucket-Sortiers."},es:{title:"Bucket Sort",timeComplexity:"Tiempo: O(n + k) donde n es el n\xfamero de elementos y k es el n\xfamero de cubetas",spaceComplexity:"Espacio: O(n + k)",description:"El Bucket Sort es un algoritmo de ordenamiento que funciona distribuyendo los elementos de un array en un n\xfamero de cubetas. Cada cubeta se ordena individualmente, ya sea utilizando otro algoritmo de ordenamiento o aplicando recursivamente el bucket sort."},ja:{title:"バケットソート",timeComplexity:"時間: O(n + k) ここで n は要素数、k はバケットの数",spaceComplexity:"空間: O(n + k)",description:"バケットソートは、配列の要素を複数のバケットに分配することで機能するソートアルゴリズムです。各バケットは、他のソートアルゴリズムを使用するか、バケットソートを再帰的に適用して個別にソートされます。"},no:{title:"Bucket Sort",timeComplexity:"Tid: O(n + k) der n er antall elementer og k er antall b\xf8tter",spaceComplexity:"Plass: O(n + k)",description:"Bucket Sort er en sorteringsalgoritme som fungerer ved \xe5 fordele elementene i en matrise i et antall b\xf8tter. Hver b\xf8tte sorteres deretter individuelt, enten ved \xe5 bruke en annen sorteringsalgoritme eller ved \xe5 bruke bucket sort rekursivt."},sv:{title:"Bucket Sort",timeComplexity:"Tid: O(n + k) d\xe4r n \xe4r antalet element och k \xe4r antalet hinkar",spaceComplexity:"Utrymme: O(n + k)",description:"Bucket Sort \xe4r en sorteringsalgoritm som fungerar genom att distribuera elementen i en array i ett antal hinkar. Varje hink sorteras sedan individuellt, antingen med en annan sorteringsalgoritm eller genom att rekursivt till\xe4mpa bucket sort."},ua:{title:"Сортування по кошиках",timeComplexity:"Час: O(n + k), де n - кількість елементів, а k - кількість кошиків",spaceComplexity:"Місце: O(n + k)",description:"Сортування по кошиках - це алгоритм сортування, який працює шляхом розподілу елементів масиву на кілька кошиків. Кожен кошик потім сортується окремо, або за допомогою іншого алгоритму сортування, або рекурсивно застосовуючи сортування по кошиках."},ru:{title:"Сортировка по карманам",timeComplexity:"Время: O(n + k), где n - количество элементов, а k - количество карманов",spaceComplexity:"Место: O(n + k)",description:"Сортировка по карманам - это алгоритм сортировки, который работает путем распределения элементов массива по ряду карманов. Каждый карман затем сортируется отдельно, либо с использованием другого алгоритма сортировки, либо рекурсивным применением сортировки по карманам."}},shell:{en:{title:"Shell Sort",timeComplexity:"Time: O(n^2) in the worst case, but can be much better with a good gap sequence",spaceComplexity:"Space: O(1)",description:"Shell Sort is an in-place comparison sort that generalizes insertion sort to allow the exchange of items that are far apart. The algorithm starts by sorting pairs of elements far apart from each other, then progressively reducing the gap between elements to be compared."},fr:{title:"Tri de Shell",timeComplexity:"Temps : O(n^2) dans le pire des cas, mais peut \xeatre bien meilleur avec une bonne s\xe9quence de gaps",spaceComplexity:"Espace : O(1)",description:"Le tri de Shell est un tri par comparaison en place qui g\xe9n\xe9ralise le tri par insertion pour permettre l'\xe9change d'\xe9l\xe9ments \xe9loign\xe9s les uns des autres. L'algorithme commence par trier des paires d'\xe9l\xe9ments \xe9loign\xe9s les uns des autres, puis r\xe9duit progressivement l'\xe9cart entre les \xe9l\xe9ments \xe0 comparer."},it:{title:"Shell Sort",timeComplexity:"Tempo: O(n^2) nel peggiore dei casi, ma pu\xf2 essere molto migliore con una buona sequenza di gap",spaceComplexity:"Spazio: O(1)",description:"Il Shell Sort \xe8 un ordinamento in loco per confronto che generalizza l'ordinamento per inserzione per consentire lo scambio di elementi distanti tra loro. L'algoritmo inizia ordinando coppie di elementi distanti tra loro, quindi riduce progressivamente la distanza tra gli elementi da confrontare."},de:{title:"Shell Sort",timeComplexity:"Zeit: O(n^2) im schlimmsten Fall, kann aber mit einer guten Gap-Sequenz viel besser sein",spaceComplexity:"Platz: O(1)",description:"Shell Sort ist ein In-Place-Vergleichssortieralgorithmus, der den Insertionssort verallgemeinert, um den Austausch von Elementen zu erm\xf6glichen, die weit voneinander entfernt sind. Der Algorithmus beginnt mit dem Sortieren von Paaren von Elementen, die weit voneinander entfernt sind, und reduziert dann nach und nach den Abstand zwischen den zu vergleichenden Elementen."},es:{title:"Shell Sort",timeComplexity:"Tiempo: O(n^2) en el peor de los casos, pero puede ser mucho mejor con una buena secuencia de intervalos",spaceComplexity:"Espacio: O(1)",description:"El Shell Sort es un ordenamiento in situ por comparaci\xf3n que generaliza el ordenamiento por inserci\xf3n para permitir el intercambio de elementos que est\xe1n muy separados. El algoritmo comienza ordenando pares de elementos muy separados entre s\xed, y luego reduce progresivamente el intervalo entre los elementos a comparar."},ja:{title:"シェルソート",timeComplexity:"時間: 最悪の場合 O(n^2) ですが、適切なギャップシーケンスを使用すると大幅に改善できます",spaceComplexity:"空間: O(1)",description:"シェルソートは、離れた項目の交換を可能にする挿入ソートを一般化したインプレース比較ソートです。このアルゴリズムは、互いに遠く離れた要素のペアをソートすることから始まり、比較する要素間のギャップを徐々に減らしていきます。"},no:{title:"Shell Sort",timeComplexity:"Tid: O(n^2) i verste fall, men kan v\xe6re mye bedre med en god gapsekvens",spaceComplexity:"Plass: O(1)",description:"Shell Sort er en in-place sammenligningssortering som generaliserer innsettingssortering for \xe5 tillate bytte av elementer som er langt fra hverandre. Algoritmen starter med \xe5 sortere par av elementer langt fra hverandre, og reduserer deretter gradvis gapet mellom elementene som skal sammenlignes."},sv:{title:"Shell Sort",timeComplexity:"Tid: O(n^2) i v\xe4rsta fall, men kan vara mycket b\xe4ttre med en bra gapsekvens",spaceComplexity:"Utrymme: O(1)",description:"Shell Sort \xe4r en in-place-j\xe4mf\xf6relsesortering som generaliserar ins\xe4ttningssortering f\xf6r att m\xf6jligg\xf6ra byte av objekt som \xe4r l\xe5ngt ifr\xe5n varandra. Algoritmen b\xf6rjar med att sortera par av element l\xe5ngt ifr\xe5n varandra och minskar sedan successivt gapet mellan elementen som ska j\xe4mf\xf6ras."},ua:{title:"Сортування Шелла",timeComplexity:"Час: O(n^2) у найгіршому випадку, але може бути набагато кращим із хорошою послідовністю проміжків",spaceComplexity:"Місце: O(1)",description:"Сортування Шелла - це порівняльне сортування на місці, яке узагальнює сортування вставками, щоб дозволити обмін елементами, які знаходяться далеко один від одного. Алгоритм починає з сортування пар елементів, які знаходяться далеко один від одного, а потім поступово зменшує проміжок між елементами для порівняння."},ru:{title:"Сортировка Шелла",timeComplexity:"Время: O(n^2) в худшем случае, но может быть намного лучше с хорошей последовательностью промежутков",spaceComplexity:"Место: O(1)",description:"Сортировка Шелла - это сортировка на месте методом сравнения, которая обобщает сортировку вставками, чтобы позволить обмен элементами, которые находятся далеко друг от друга. Алгоритм начинается с сортировки пар элементов, находящихся далеко друг от друга, затем постепенно уменьшает разрыв между сравниваемыми элементами."}}},d={bubble:"n2",insertion:"n2",heap:"nlogn",quick:"nlogn",merge:"nlogn",radix:"n+k",counting:"n+k",bucket:"n+k",shell:"n2-adaptive"};function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:40,r=Array.from({length:i+1},(r,n)=>{let a=n/i*t;return{n:a,v:e(Math.max(a,1))}}),n=Math.max(...r.map(e=>e.v));return r.map(e=>({n:e.n,v:e.v/n}))}let c={n2:e=>e*e,nlogn:e=>e*Math.log2(Math.max(e,2)),"n+k":e=>e,"n2-adaptive":e=>e*Math.log2(Math.max(e,2))*1.3},p={en:{brand:"Valgo",tagline:"Watch how sorting actually works.",play:"Play",pause:"Pause",resume:"Resume",reset:"New shuffle",shuffle:"Shuffle",algorithm:"Algorithm",language:"Language",arraySize:"Array size",elements:"elements",speed:"Speed",speedSlow:"Slow",speedNormal:"Normal",speedFast:"Fast",speedTurbo:"Turbo",comparisons:"Comparisons",writes:"Writes",step:"Step",of:"of",sorted:"Sorted",license:"MIT License",viewLicense:"License",close:"Close",footerRights:"All rights reserved.",growthTitle:"How the work grows",growthCaption:"Same n, wildly different amounts of work.",narrationTitle:"What's happening",statsTitle:"Live stats",pickAlgorithm:"Choose an algorithm",done:"Sorted! Every value found its place."},fr:{brand:"Valgo",tagline:"Regardez comment le tri fonctionne vraiment.",play:"Lecture",pause:"Pause",resume:"Reprendre",reset:"Nouveau m\xe9lange",shuffle:"M\xe9langer",algorithm:"Algorithme",language:"Langue",arraySize:"Taille du tableau",elements:"\xe9l\xe9ments",speed:"Vitesse",speedSlow:"Lent",speedNormal:"Normal",speedFast:"Rapide",speedTurbo:"Turbo",comparisons:"Comparaisons",writes:"\xc9critures",step:"\xc9tape",of:"sur",sorted:"Tri\xe9s",license:"Licence MIT",viewLicense:"Licence",close:"Fermer",footerRights:"Tous droits r\xe9serv\xe9s.",growthTitle:"Comment le travail augmente",growthCaption:"M\xeame n, quantit\xe9s de travail tr\xe8s diff\xe9rentes.",narrationTitle:"Ce qui se passe",statsTitle:"Statistiques en direct",pickAlgorithm:"Choisir un algorithme",done:"Tri\xe9 ! Chaque valeur a trouv\xe9 sa place."},it:{brand:"Valgo",tagline:"Guarda come funziona davvero l'ordinamento.",play:"Avvia",pause:"Pausa",resume:"Riprendi",reset:"Nuovo mescolamento",shuffle:"Mescola",algorithm:"Algoritmo",language:"Lingua",arraySize:"Dimensione array",elements:"elementi",speed:"Velocit\xe0",speedSlow:"Lenta",speedNormal:"Normale",speedFast:"Veloce",speedTurbo:"Turbo",comparisons:"Confronti",writes:"Scritture",step:"Passo",of:"di",sorted:"Ordinati",license:"Licenza MIT",viewLicense:"Licenza",close:"Chiudi",footerRights:"Tutti i diritti riservati.",growthTitle:"Come cresce il lavoro",growthCaption:"Stesso n, quantit\xe0 di lavoro molto diverse.",narrationTitle:"Cosa sta succedendo",statsTitle:"Statistiche live",pickAlgorithm:"Scegli un algoritmo",done:"Ordinato! Ogni valore ha trovato il suo posto."},de:{brand:"Valgo",tagline:"Sieh dir an, wie Sortieren wirklich funktioniert.",play:"Abspielen",pause:"Pause",resume:"Fortsetzen",reset:"Neu mischen",shuffle:"Mischen",algorithm:"Algorithmus",language:"Sprache",arraySize:"Array-Gr\xf6\xdfe",elements:"Elemente",speed:"Geschwindigkeit",speedSlow:"Langsam",speedNormal:"Normal",speedFast:"Schnell",speedTurbo:"Turbo",comparisons:"Vergleiche",writes:"Schreibvorg\xe4nge",step:"Schritt",of:"von",sorted:"Sortiert",license:"MIT-Lizenz",viewLicense:"Lizenz",close:"Schlie\xdfen",footerRights:"Alle Rechte vorbehalten.",growthTitle:"Wie die Arbeit w\xe4chst",growthCaption:"Gleiches n, sehr unterschiedlicher Aufwand.",narrationTitle:"Was gerade passiert",statsTitle:"Live-Statistik",pickAlgorithm:"Algorithmus w\xe4hlen",done:"Fertig sortiert! Jeder Wert hat seinen Platz gefunden."},es:{brand:"Valgo",tagline:"Mira c\xf3mo funciona realmente el ordenamiento.",play:"Reproducir",pause:"Pausa",resume:"Reanudar",reset:"Nueva mezcla",shuffle:"Mezclar",algorithm:"Algoritmo",language:"Idioma",arraySize:"Tama\xf1o del array",elements:"elementos",speed:"Velocidad",speedSlow:"Lenta",speedNormal:"Normal",speedFast:"R\xe1pida",speedTurbo:"Turbo",comparisons:"Comparaciones",writes:"Escrituras",step:"Paso",of:"de",sorted:"Ordenados",license:"Licencia MIT",viewLicense:"Licencia",close:"Cerrar",footerRights:"Todos los derechos reservados.",growthTitle:"C\xf3mo crece el trabajo",growthCaption:"Mismo n, cantidades de trabajo muy distintas.",narrationTitle:"Qu\xe9 est\xe1 pasando",statsTitle:"Estad\xedsticas en vivo",pickAlgorithm:"Elige un algoritmo",done:"\xa1Ordenado! Cada valor encontr\xf3 su lugar."},ja:{brand:"Valgo",tagline:"ソートが実際にどう動くかを見てみましょう。",play:"再生",pause:"一時停止",resume:"再開",reset:"シャッフル",shuffle:"シャッフル",algorithm:"アルゴリズム",language:"言語",arraySize:"配列サイズ",elements:"要素",speed:"速度",speedSlow:"遅い",speedNormal:"普通",speedFast:"速い",speedTurbo:"高速",comparisons:"比較回数",writes:"書き込み回数",step:"ステップ",of:"/",sorted:"ソート済み",license:"MITライセンス",viewLicense:"ライセンス",close:"閉じる",footerRights:"全著作権所有。",growthTitle:"処理量の増え方",growthCaption:"同じ n でも、処理量は大きく異なります。",narrationTitle:"今起きていること",statsTitle:"リアルタイム統計",pickAlgorithm:"アルゴリズムを選択",done:"完了!すべての値が正しい位置に収まりました。"},no:{brand:"Valgo",tagline:"Se hvordan sortering faktisk fungerer.",play:"Spill av",pause:"Pause",resume:"Fortsett",reset:"Stokk p\xe5 nytt",shuffle:"Stokk",algorithm:"Algoritme",language:"Spr\xe5k",arraySize:"Matrisest\xf8rrelse",elements:"elementer",speed:"Hastighet",speedSlow:"Sakte",speedNormal:"Normal",speedFast:"Rask",speedTurbo:"Turbo",comparisons:"Sammenligninger",writes:"Skrivinger",step:"Steg",of:"av",sorted:"Sortert",license:"MIT-lisens",viewLicense:"Lisens",close:"Lukk",footerRights:"Alle rettigheter forbeholdt.",growthTitle:"Hvordan arbeidet vokser",growthCaption:"Samme n, sv\xe6rt ulik mengde arbeid.",narrationTitle:"Hva skjer n\xe5",statsTitle:"Sanntidsstatistikk",pickAlgorithm:"Velg en algoritme",done:"Ferdig sortert! Hver verdi fant sin plass."},sv:{brand:"Valgo",tagline:"Se hur sortering faktiskt fungerar.",play:"Spela",pause:"Pausa",resume:"Forts\xe4tt",reset:"Blanda igen",shuffle:"Blanda",algorithm:"Algoritm",language:"Spr\xe5k",arraySize:"Array-storlek",elements:"element",speed:"Hastighet",speedSlow:"L\xe5ngsam",speedNormal:"Normal",speedFast:"Snabb",speedTurbo:"Turbo",comparisons:"J\xe4mf\xf6relser",writes:"Skrivningar",step:"Steg",of:"av",sorted:"Sorterade",license:"MIT-licens",viewLicense:"Licens",close:"St\xe4ng",footerRights:"Alla r\xe4ttigheter f\xf6rbeh\xe5llna.",growthTitle:"Hur arbetet v\xe4xer",growthCaption:"Samma n, v\xe4ldigt olika m\xe4ngd arbete.",narrationTitle:"Vad som h\xe4nder",statsTitle:"Livestatistik",pickAlgorithm:"V\xe4lj en algoritm",done:"Klart! Varje v\xe4rde hittade sin plats."},ua:{brand:"Valgo",tagline:"Подивіться, як насправді працює сортування.",play:"Старт",pause:"Пауза",resume:"Продовжити",reset:"Перемішати",shuffle:"Перемішати",algorithm:"Алгоритм",language:"Мова",arraySize:"Розмір масиву",elements:"елементів",speed:"Швидкість",speedSlow:"Повільно",speedNormal:"Звичайно",speedFast:"Швидко",speedTurbo:"Турбо",comparisons:"Порівняння",writes:"Записи",step:"Крок",of:"з",sorted:"Відсортовано",license:"Ліцензія MIT",viewLicense:"Ліцензія",close:"Закрити",footerRights:"Усі права захищено.",growthTitle:"Як зростає обсяг роботи",growthCaption:"Те саме n, зовсім різний обсяг роботи.",narrationTitle:"Що відбувається",statsTitle:"Статистика наживо",pickAlgorithm:"Оберіть алгоритм",done:"Відсортовано! Кожне значення знайшло своє місце."},ru:{brand:"Valgo",tagline:"Посмотрите, как на самом деле работает сортировка.",play:"Старт",pause:"Пауза",resume:"Продолжить",reset:"Перемешать",shuffle:"Перемешать",algorithm:"Алгоритм",language:"Язык",arraySize:"Размер массива",elements:"элементов",speed:"Скорость",speedSlow:"Медленно",speedNormal:"Обычно",speedFast:"Быстро",speedTurbo:"Турбо",comparisons:"Сравнения",writes:"Записи",step:"Шаг",of:"из",sorted:"Отсортировано",license:"Лицензия MIT",viewLicense:"Лицензия",close:"Закрыть",footerRights:"Все права защищены.",growthTitle:"Как растёт объём работы",growthCaption:"Одно и то же n, совершенно разный объём работы.",narrationTitle:"Что происходит",statsTitle:"Статистика в реальном времени",pickAlgorithm:"Выберите алгоритм",done:"Отсортировано! Каждое значение нашло своё место."}};function u(e,t){var i,r;return null!=(r=null==(i=p[e])?void 0:i[t])?r:p.en[t]}function g(e,t){return e.replace(/\{(\w+)\}/g,(e,i)=>{var r;return String(null!=(r=t[i])?r:"")})}let h={en:{init:"A freshly shuffled array of {n} numbers. Watch {algo} bring order to it.",compare:"Comparing positions {a} and {b}: {va} vs {vb}.",swapYes:"{va} > {vb}, so they're out of order — swap positions {a} and {b}.",overwrite:"Writing {va} into position {a}.",shift:"Sliding {va} rightward to open a gap.",selectPivot:"Choosing {va} (position {a}) as the pivot.",partitionRange:"Partitioning the range [{low}, {high}] around the pivot.",pivotPlaced:"The pivot is home — {va} is now permanently in its sorted spot at {a}.",mergeRange:"Merging two sorted halves: [{low}..{mid}] and [{mid1}..{high}].",mergeWrite:"The smaller candidate, {va}, goes into position {a}.",markSorted:"Position {a} is locked in as sorted.",shellGap:"Shrinking the gap to {gap} — comparisons now leap across the array instead of crawling.",radixDigit:"Now sorting by the digit worth {digit}, least significant first.",bucketPlace:"{va} drops into bucket {bucket}, grouped by value range.",bucketSorted:"Sorting the contents of bucket {bucket} on its own.",countingTally:"Tallying how many times {va} appears.",done:"Sorted! Every element found its final place."},fr:{init:"Un tableau de {n} nombres m\xe9lang\xe9s. Regardez {algo} y mettre de l'ordre.",compare:"Comparaison des positions {a} et {b} : {va} contre {vb}.",swapYes:"{va} > {vb}, donc c'est dans le mauvais ordre — \xe9change des positions {a} et {b}.",overwrite:"\xc9criture de {va} en position {a}.",shift:"D\xe9calage de {va} vers la droite pour laisser de la place.",selectPivot:"Choix de {va} (position {a}) comme pivot.",partitionRange:"Partition de la plage [{low}, {high}] autour du pivot.",pivotPlaced:"Le pivot est \xe0 sa place — {va} est d\xe9sormais d\xe9finitivement tri\xe9 en position {a}.",mergeRange:"Fusion de deux moiti\xe9s d\xe9j\xe0 tri\xe9es : [{low}..{mid}] et [{mid1}..{high}].",mergeWrite:"Le plus petit candidat, {va}, est plac\xe9 en position {a}.",markSorted:"La position {a} est d\xe9sormais fix\xe9e comme tri\xe9e.",shellGap:"R\xe9duction de l'\xe9cart \xe0 {gap} — les comparaisons sautent maintenant \xe0 travers le tableau.",radixDigit:"Tri maintenant selon le chiffre de rang {digit}, du moins significatif d'abord.",bucketPlace:"{va} est plac\xe9 dans le compartiment {bucket}, selon sa valeur.",bucketSorted:"Tri du contenu du compartiment {bucket} ind\xe9pendamment.",countingTally:"Comptage du nombre d'occurrences de {va}.",done:"Tri\xe9 ! Chaque \xe9l\xe9ment a trouv\xe9 sa place finale."},it:{init:"Un array di {n} numeri appena mescolato. Guarda {algo} metterlo in ordine.",compare:"Confronto tra le posizioni {a} e {b}: {va} contro {vb}.",swapYes:"{va} > {vb}, quindi sono nell'ordine sbagliato — scambio le posizioni {a} e {b}.",overwrite:"Scrivo {va} nella posizione {a}.",shift:"Sposto {va} verso destra per fare spazio.",selectPivot:"Scelgo {va} (posizione {a}) come pivot.",partitionRange:"Partiziono l'intervallo [{low}, {high}] attorno al pivot.",pivotPlaced:"Il pivot \xe8 a casa — {va} \xe8 ora definitivamente ordinato in posizione {a}.",mergeRange:"Fondo due met\xe0 gi\xe0 ordinate: [{low}..{mid}] e [{mid1}..{high}].",mergeWrite:"Il candidato pi\xf9 piccolo, {va}, va in posizione {a}.",markSorted:"La posizione {a} \xe8 ora fissata come ordinata.",shellGap:"Riduco il gap a {gap} — i confronti ora saltano attraverso l'array invece di procedere passo passo.",radixDigit:"Ora ordino in base alla cifra di peso {digit}, a partire dalla meno significativa.",bucketPlace:"{va} finisce nel bucket {bucket}, in base al suo valore.",bucketSorted:"Ordino il contenuto del bucket {bucket} per conto suo.",countingTally:"Conto quante volte compare {va}.",done:"Ordinato! Ogni elemento ha trovato il suo posto finale."},de:{init:"Ein frisch gemischtes Array aus {n} Zahlen. Sieh zu, wie {algo} Ordnung schafft.",compare:"Vergleiche Position {a} und {b}: {va} gegen {vb}.",swapYes:"{va} > {vb}, also falsche Reihenfolge — tausche Position {a} und {b}.",overwrite:"Schreibe {va} an Position {a}.",shift:"Verschiebe {va} nach rechts, um Platz zu schaffen.",selectPivot:"W\xe4hle {va} (Position {a}) als Pivot.",partitionRange:"Partitioniere den Bereich [{low}, {high}] um den Pivot herum.",pivotPlaced:"Der Pivot ist angekommen — {va} steht jetzt endg\xfcltig sortiert an Position {a}.",mergeRange:"Verschmelze zwei bereits sortierte H\xe4lften: [{low}..{mid}] und [{mid1}..{high}].",mergeWrite:"Der kleinere Kandidat, {va}, kommt an Position {a}.",markSorted:"Position {a} ist nun endg\xfcltig sortiert.",shellGap:"Verringere den Abstand auf {gap} — Vergleiche springen jetzt \xfcber das Array statt zu kriechen.",radixDigit:"Jetzt wird nach der Ziffernstelle {digit} sortiert, zuerst die niedrigstwertige.",bucketPlace:"{va} kommt in Eimer {bucket}, gruppiert nach Wertebereich.",bucketSorted:"Sortiere den Inhalt von Eimer {bucket} f\xfcr sich.",countingTally:"Z\xe4hle, wie oft {va} vorkommt.",done:"Fertig sortiert! Jedes Element hat seinen endg\xfcltigen Platz gefunden."},es:{init:"Un array reci\xe9n mezclado de {n} n\xfameros. Observa c\xf3mo {algo} le pone orden.",compare:"Comparando las posiciones {a} y {b}: {va} frente a {vb}.",swapYes:"{va} > {vb}, as\xed que est\xe1n desordenados — intercambio las posiciones {a} y {b}.",overwrite:"Escribiendo {va} en la posici\xf3n {a}.",shift:"Deslizo {va} hacia la derecha para abrir hueco.",selectPivot:"Elijo {va} (posici\xf3n {a}) como pivote.",partitionRange:"Particiono el rango [{low}, {high}] alrededor del pivote.",pivotPlaced:"El pivote lleg\xf3 a casa — {va} ya est\xe1 definitivamente ordenado en la posici\xf3n {a}.",mergeRange:"Fusionando dos mitades ya ordenadas: [{low}..{mid}] y [{mid1}..{high}].",mergeWrite:"El candidato m\xe1s peque\xf1o, {va}, va a la posici\xf3n {a}.",markSorted:"La posici\xf3n {a} queda fijada como ordenada.",shellGap:"Reduzco el intervalo a {gap} — las comparaciones ahora saltan por el array en vez de arrastrarse.",radixDigit:"Ahora ordenando por el d\xedgito de valor {digit}, empezando por el menos significativo.",bucketPlace:"{va} cae en el cubo {bucket}, agrupado por rango de valor.",bucketSorted:"Ordenando el contenido del cubo {bucket} por separado.",countingTally:"Contando cu\xe1ntas veces aparece {va}.",done:"\xa1Ordenado! Cada elemento encontr\xf3 su lugar final."},ja:{init:"{n} 個の数をシャッフルした配列です。{algo} が整えていく様子を見てみましょう。",compare:"位置 {a} と {b} を比較: {va} と {vb}。",swapYes:"{va} > {vb} のため順序が逆です — 位置 {a} と {b} を交換します。",overwrite:"{va} を位置 {a} に書き込みます。",shift:"{va} を右にずらして隙間を作ります。",selectPivot:"{va}(位置 {a})をピボットに選びます。",partitionRange:"ピボットを中心に範囲 [{low}, {high}] を分割します。",pivotPlaced:"ピボットが定位置に到着 — {va} は位置 {a} で確定的にソート済みです。",mergeRange:"すでにソート済みの2つの半分 [{low}..{mid}] と [{mid1}..{high}] を結合します。",mergeWrite:"小さい方の候補 {va} を位置 {a} に書き込みます。",markSorted:"位置 {a} はソート済みとして確定しました。",shellGap:"間隔を {gap} に縮めます — 比較が一歩ずつではなく配列を飛び越えて行われます。",radixDigit:"桁の重み {digit} で並べ替え中です(下位桁から順に)。",bucketPlace:"{va} は値の範囲に応じてバケット {bucket} に入ります。",bucketSorted:"バケット {bucket} の中身を個別にソートします。",countingTally:"{va} が何回出現するかを数えています。",done:"完了!すべての要素が最終的な位置に収まりました。"},no:{init:"En nyblandet matrise med {n} tall. Se hvordan {algo} skaper orden.",compare:"Sammenligner posisjon {a} og {b}: {va} mot {vb}.",swapYes:"{va} > {vb}, alts\xe5 feil rekkef\xf8lge — bytter posisjon {a} og {b}.",overwrite:"Skriver {va} til posisjon {a}.",shift:"Flytter {va} mot h\xf8yre for \xe5 lage plass.",selectPivot:"Velger {va} (posisjon {a}) som pivot.",partitionRange:"Partisjonerer omr\xe5det [{low}, {high}] rundt pivoten.",pivotPlaced:"Pivoten er hjemme — {va} er n\xe5 permanent sortert p\xe5 posisjon {a}.",mergeRange:"Sl\xe5r sammen to sorterte halvdeler: [{low}..{mid}] og [{mid1}..{high}].",mergeWrite:"Den minste kandidaten, {va}, g\xe5r til posisjon {a}.",markSorted:"Posisjon {a} er n\xe5 l\xe5st som sortert.",shellGap:"Krymper gapet til {gap} — sammenligninger hopper n\xe5 over matrisen i stedet for \xe5 krype.",radixDigit:"Sorterer n\xe5 etter sifferverdi {digit}, minst betydningsfulle f\xf8rst.",bucketPlace:"{va} havner i b\xf8tte {bucket}, gruppert etter verdiomr\xe5de.",bucketSorted:"Sorterer innholdet i b\xf8tte {bucket} for seg selv.",countingTally:"Teller hvor mange ganger {va} forekommer.",done:"Ferdig sortert! Hvert element fant sin endelige plass."},sv:{init:"En nyblandad array med {n} tal. Se hur {algo} skapar ordning.",compare:"J\xe4mf\xf6r position {a} och {b}: {va} mot {vb}.",swapYes:"{va} > {vb}, s\xe5 de \xe4r i fel ordning — byter position {a} och {b}.",overwrite:"Skriver {va} till position {a}.",shift:"Flyttar {va} \xe5t h\xf6ger f\xf6r att g\xf6ra plats.",selectPivot:"V\xe4ljer {va} (position {a}) som pivot.",partitionRange:"Partitionerar intervallet [{low}, {high}] runt pivoten.",pivotPlaced:"Pivoten \xe4r hemma — {va} \xe4r nu permanent sorterad p\xe5 position {a}.",mergeRange:"Sl\xe5r ihop tv\xe5 sorterade halvor: [{low}..{mid}] och [{mid1}..{high}].",mergeWrite:"Den minsta kandidaten, {va}, hamnar p\xe5 position {a}.",markSorted:"Position {a} \xe4r nu l\xe5st som sorterad.",shellGap:"Minskar gapet till {gap} — j\xe4mf\xf6relser hoppar nu \xf6ver arrayen ist\xe4llet f\xf6r att krypa.",radixDigit:"Sorterar nu efter sifferv\xe4rdet {digit}, minst signifikant f\xf6rst.",bucketPlace:"{va} hamnar i hink {bucket}, grupperad efter v\xe4rdeintervall.",bucketSorted:"Sorterar inneh\xe5llet i hink {bucket} f\xf6r sig.",countingTally:"R\xe4knar hur m\xe5nga g\xe5nger {va} f\xf6rekommer.",done:"Klart sorterat! Varje element hittade sin slutgiltiga plats."},ua:{init:"Щойно перемішаний масив із {n} чисел. Подивіться, як {algo} наводить лад.",compare:"Порівнюємо позиції {a} і {b}: {va} проти {vb}.",swapYes:"{va} > {vb}, тож порядок неправильний — міняємо місцями позиції {a} і {b}.",overwrite:"Записуємо {va} у позицію {a}.",shift:"Зсуваємо {va} праворуч, щоб звільнити місце.",selectPivot:"Обираємо {va} (позиція {a}) як опорний елемент.",partitionRange:"Розбиваємо діапазон [{low}, {high}] навколо опорного елемента.",pivotPlaced:"Опорний елемент на місці — {va} тепер остаточно відсортовано на позиції {a}.",mergeRange:"Зливаємо дві вже відсортовані половини: [{low}..{mid}] і [{mid1}..{high}].",mergeWrite:"Менший кандидат, {va}, іде на позицію {a}.",markSorted:"Позиція {a} тепер зафіксована як відсортована.",shellGap:"Зменшуємо проміжок до {gap} — порівняння тепер перестрибують масив, а не повзуть.",radixDigit:"Тепер сортуємо за розрядом {digit}, спочатку наймолодшим.",bucketPlace:"{va} потрапляє в кошик {bucket} за діапазоном значення.",bucketSorted:"Сортуємо вміст кошика {bucket} окремо.",countingTally:"Рахуємо, скільки разів трапляється {va}.",done:"Відсортовано! Кожен елемент знайшов своє остаточне місце."},ru:{init:"Только что перемешанный массив из {n} чисел. Смотрите, как {algo} наводит порядок.",compare:"Сравниваем позиции {a} и {b}: {va} против {vb}.",swapYes:"{va} > {vb}, значит порядок неверный — меняем местами позиции {a} и {b}.",overwrite:"Записываем {va} в позицию {a}.",shift:"Сдвигаем {va} вправо, чтобы освободить место.",selectPivot:"Выбираем {va} (позиция {a}) в качестве опорного элемента.",partitionRange:"Разбиваем диапазон [{low}, {high}] вокруг опорного элемента.",pivotPlaced:"Опорный элемент на месте — {va} теперь окончательно отсортирован на позиции {a}.",mergeRange:"Сливаем две уже отсортированные половины: [{low}..{mid}] и [{mid1}..{high}].",mergeWrite:"Меньший кандидат, {va}, идёт на позицию {a}.",markSorted:"Позиция {a} теперь зафиксирована как отсортированная.",shellGap:"Уменьшаем промежуток до {gap} — сравнения теперь перепрыгивают через массив, а не ползут.",radixDigit:"Теперь сортируем по разряду {digit}, начиная с младшего.",bucketPlace:"{va} попадает в корзину {bucket} по диапазону значения.",bucketSorted:"Сортируем содержимое корзины {bucket} отдельно.",countingTally:"Считаем, сколько раз встречается {va}.",done:"Отсортировано! Каждый элемент нашёл своё окончательное место."}},f={idle:"hsl(var(--state-idle))",compare:"hsl(var(--state-compare))",swap:"hsl(var(--state-swap))",sorted:"hsl(var(--state-sorted))",pivot:"hsl(var(--state-pivot))"};function v(e){let{values:t,indices:i,action:n,sorted:o,range:s,pivotIndex:l,stepDurationMs:d,height:m=320}=e,c=Math.max(...t,1),p=new Set(o),u=t.length,g=u<=36,h=u>0?Math.min(1.2,40/u):.6,v=i[0],b=i[1],x=Math.max(.08,Math.min(.35,d/1e3));return(0,r.jsxs)("div",{className:"relative w-full select-none",style:{height:m+40},children:[(0,r.jsx)("div",{className:"absolute bottom-10 left-0 right-0 flex items-end justify-center gap-[var(--gap)] px-2",style:{height:m,"--gap":"".concat(h,"%")},children:t.map((e,t)=>{var o,m,u,h,v,b;let x=(o=t,m=i,u=n,h=p,v=s,b=l,h.has(o)?f.sorted:b===o?f.pivot:m.includes(o)?"swap"===u||"shift"===u||"merge-write"===u||"overwrite"===u?f.swap:f.compare:v&&o>=v[0]&&o<=v[1]?"hsl(var(--state-active-range) / 0.55)":f.idle),y=i.includes(t)||l===t;return(0,r.jsx)(a.P.div,{className:"relative flex-1 rounded-t-[3px] min-w-[2px]",style:{backgroundColor:x},animate:{height:"".concat(e/c*100,"%"),backgroundColor:x,boxShadow:y?"0 0 16px ".concat(x):"0 0 0 rgba(0,0,0,0)"},transition:{duration:Math.max(.08,Math.min(.4,d/1e3)),ease:"easeInOut"},children:g&&(0,r.jsx)("span",{className:"absolute -top-5 left-1/2 -translate-x-1/2 text-[10px] font-mono tabular-nums",style:{color:x},children:e})},t)})}),(0,r.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 h-8 px-2",children:[u>0&&void 0!==v&&(0,r.jsx)(a.P.div,{className:"absolute bottom-0 flex flex-col items-center",style:{width:"".concat(100/u,"%")},animate:{left:"".concat(v/u*100,"%")},transition:{duration:x,ease:"easeInOut"},children:(0,r.jsx)("div",{className:"h-0 w-0 border-x-[6px] border-x-transparent border-b-[8px]",style:{borderBottomColor:"swap"===n?f.swap:f.compare}})}),u>0&&void 0!==b&&b!==v&&(0,r.jsx)(a.P.div,{className:"absolute bottom-0 flex flex-col items-center",style:{width:"".concat(100/u,"%")},animate:{left:"".concat(b/u*100,"%")},transition:{duration:x,ease:"easeInOut"},children:(0,r.jsx)("div",{className:"h-0 w-0 border-x-[6px] border-x-transparent border-b-[8px]",style:{borderBottomColor:"swap"===n?f.swap:f.compare}})})]})]})}let b=[{key:"n+k",color:"hsl(var(--state-sorted))"},{key:"nlogn",color:"hsl(var(--primary))"},{key:"n2-adaptive",color:"hsl(var(--state-pivot))"},{key:"n2",color:"hsl(var(--state-swap))"}];function x(e){let{active:t,n:i,maxN:n,labels:o}=e;return(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsxs)("svg",{viewBox:"0 0 ".concat(320," ").concat(160),className:"w-full h-auto overflow-visible",children:[(0,r.jsx)("line",{x1:10,y1:150,x2:310,y2:150,stroke:"hsl(var(--border))",strokeWidth:1}),(0,r.jsx)("line",{x1:10,y1:10,x2:10,y2:150,stroke:"hsl(var(--border))",strokeWidth:1}),b.map(e=>{let{key:i,color:o}=e,s=m(c[i],n),l=i===t;return(0,r.jsx)(a.P.path,{d:s.map((e,t)=>{let i=10+e.n/n*300,r=150-140*e.v;return"".concat(0===t?"M":"L"," ").concat(i.toFixed(1)," ").concat(r.toFixed(1))}).join(" "),fill:"none",stroke:o,strokeWidth:l?2.75:1.25,strokeOpacity:l?1:.28,strokeLinecap:"round",initial:!1,animate:{strokeOpacity:l?1:.28,strokeWidth:l?2.75:1.25},transition:{duration:.4}},i)}),(()=>{var e,o;let s=m(c[t],n,200).reduce((e,t)=>Math.abs(t.n-i)e.key===t))?void 0:e.color)?o:"hsl(var(--primary))";return(0,r.jsx)(a.P.circle,{cx:l,cy:d,r:4,fill:p,animate:{cx:l,cy:d},transition:{duration:.4}})})()]}),(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1.5 text-xs font-mono",children:b.map(e=>{let{key:i,color:n}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-1.5",style:{opacity:i===t?1:.45},children:[(0,r.jsx)("span",{className:"inline-block h-2 w-2 rounded-full",style:{backgroundColor:n}}),(0,r.jsx)("span",{style:{color:i===t?n:"hsl(var(--muted-foreground))"},children:o[i]})]},i)})})]})}var y=i(1408),k=i(2821),w=i(5889);function S(){for(var e=arguments.length,t=Array(e),i=0;i{let{className:i,variant:n,size:a,asChild:o=!1,...s}=e,l=o?R.DX:"button";return(0,r.jsx)(l,{className:S(A({variant:n,size:a,className:i})),ref:t,...s})});L.displayName="Button";var I=i(5130);let M=n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsxs)(I.bL,{ref:t,className:S("relative flex w-full touch-none select-none items-center",i),...n,children:[(0,r.jsx)(I.CC,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:(0,r.jsx)(I.Q6,{className:"absolute h-full bg-primary"})}),(0,r.jsx)(I.zi,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]})});M.displayName=I.bL.displayName;let q=["slow","normal","fast","turbo"];function D(e){let{isPlaying:t,onTogglePlay:i,onShuffle:n,onReset:a,arraySize:o,onArraySizeChange:s,speed:l,onSpeedChange:d,stepIndex:m,stepCount:c,onScrub:p,labels:u,disabled:g}=e,h={slow:u.speedSlow,normal:u.speedNormal,fast:u.speedFast,turbo:u.speedTurbo};return(0,r.jsxs)(C,{className:"space-y-5",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)(L,{onClick:i,size:"lg",className:"gap-2 min-w-[112px]",children:[t?(0,r.jsx)(T.A,{className:"h-4 w-4"}):(0,r.jsx)(z.A,{className:"h-4 w-4"}),t?u.pause:u.play]}),(0,r.jsxs)(L,{onClick:n,variant:"secondary",className:"gap-2",children:[(0,r.jsx)(E.A,{className:"h-4 w-4"}),u.shuffle]}),(0,r.jsxs)(L,{onClick:a,variant:"outline",className:"gap-2",children:[(0,r.jsx)(P.A,{className:"h-4 w-4"}),u.reset]}),(0,r.jsx)("div",{className:"ml-auto flex items-center rounded-lg border border-border overflow-hidden",children:q.map(e=>(0,r.jsx)("button",{onClick:()=>d(e),className:"px-3 py-1.5 text-xs font-medium transition-colors ".concat(l===e?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-secondary"),children:h[e]},e))})]}),c>0&&(0,r.jsx)("div",{children:(0,r.jsx)("input",{type:"range",min:0,max:c,value:m,onChange:e=>p(Number(e.target.value)),className:"w-full accent-primary h-1.5 cursor-pointer"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex justify-between text-xs text-muted-foreground mb-2",children:[(0,r.jsx)("span",{children:u.arraySize}),(0,r.jsxs)("span",{className:"font-mono",children:[o," ",u.elements]})]}),(0,r.jsx)(M,{value:[o],onValueChange:e=>s(e[0]),min:5,max:100,step:1,disabled:g})]})]})}var B=i(4033),H=i(9068),F=i(8081),V=i(7937),W=i(5917),U=i(9051);let G=F.bL,Z=F.l9;F.YJ,F.ZL,F.Pb;let Q=F.z6;n.forwardRef((e,t)=>{let{className:i,inset:n,children:a,...o}=e;return(0,r.jsxs)(F.ZP,{ref:t,className:S("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",i),...o,children:[a,(0,r.jsx)(V.A,{className:"ml-auto h-4 w-4"})]})}).displayName=F.ZP.displayName,n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(F.G5,{ref:t,className:S("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",i),...n})}).displayName=F.G5.displayName;let Y=n.forwardRef((e,t)=>{let{className:i,sideOffset:n=4,...a}=e;return(0,r.jsx)(F.ZL,{children:(0,r.jsx)(F.UC,{ref:t,sideOffset:n,className:S("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",i),...a})})});Y.displayName=F.UC.displayName,n.forwardRef((e,t)=>{let{className:i,inset:n,...a}=e;return(0,r.jsx)(F.q7,{ref:t,className:S("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",i),...a})}).displayName=F.q7.displayName,n.forwardRef((e,t)=>{let{className:i,children:n,checked:a,...o}=e;return(0,r.jsxs)(F.H_,{ref:t,className:S("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",i),checked:a,...o,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(F.VF,{children:(0,r.jsx)(W.A,{className:"h-4 w-4"})})}),n]})}).displayName=F.H_.displayName;let J=n.forwardRef((e,t)=>{let{className:i,children:n,...a}=e;return(0,r.jsxs)(F.hN,{ref:t,className:S("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",i),...a,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(F.VF,{children:(0,r.jsx)(U.A,{className:"h-2 w-2 fill-current"})})}),n]})});J.displayName=F.hN.displayName,n.forwardRef((e,t)=>{let{className:i,inset:n,...a}=e;return(0,r.jsx)(F.JU,{ref:t,className:S("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",i),...a})}).displayName=F.JU.displayName,n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(F.wv,{ref:t,className:S("-mx-1 my-1 h-px bg-muted",i),...n})}).displayName=F.wv.displayName;let _=[{key:"bubble",label:"Bubble Sort"},{key:"insertion",label:"Insertion Sort"},{key:"merge",label:"Merge Sort"},{key:"heap",label:"Heap Sort"},{key:"quick",label:"Quick Sort"},{key:"radix",label:"Radix Sort"},{key:"counting",label:"Counting Sort"},{key:"bucket",label:"Bucket Sort"},{key:"shell",label:"Shell Sort"}],K=["en","fr","it","de","es","ja","no","sv","ua","ru"];function X(e){var t,i;let{value:n,onChange:a,triggerLabel:o}=e,s=null!=(i=null==(t=_.find(e=>e.key===n))?void 0:t.label)?i:o;return(0,r.jsxs)(G,{children:[(0,r.jsx)(Z,{asChild:!0,children:(0,r.jsxs)(L,{variant:"secondary",className:"gap-2 justify-between min-w-[180px]",children:[s,(0,r.jsx)(B.A,{className:"h-4 w-4 opacity-60"})]})}),(0,r.jsx)(Y,{align:"start",children:(0,r.jsx)(Q,{value:n,onValueChange:e=>a(e),children:_.map(e=>(0,r.jsx)(J,{value:e.key,children:e.label},e.key))})})]})}function $(e){let{value:t,onChange:i}=e;return(0,r.jsxs)(G,{children:[(0,r.jsx)(Z,{asChild:!0,children:(0,r.jsxs)(L,{variant:"outline",size:"sm",className:"gap-1.5",children:[(0,r.jsx)(H.A,{className:"h-3.5 w-3.5"}),t.toUpperCase()]})}),(0,r.jsx)(Y,{align:"end",children:(0,r.jsx)(Q,{value:t,onValueChange:e=>i(e),children:K.map(e=>(0,r.jsx)(J,{value:e,children:e.toUpperCase()},e))})})]})}var ee=i(9511),et=i(5229);let ei=ee.bL,er=ee.l9,en=ee.ZL;ee.bm;let ea=n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(ee.hJ,{ref:t,className:S("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",i),...n})});ea.displayName=ee.hJ.displayName;let eo=n.forwardRef((e,t)=>{let{className:i,children:n,...a}=e;return(0,r.jsxs)(en,{children:[(0,r.jsx)(ea,{}),(0,r.jsxs)(ee.UC,{ref:t,className:S("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",i),...a,children:[n,(0,r.jsxs)(ee.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(et.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});eo.displayName=ee.UC.displayName;let es=e=>{let{className:t,...i}=e;return(0,r.jsx)("div",{className:S("flex flex-col space-y-1.5 text-center sm:text-left",t),...i})};es.displayName="DialogHeader";let el=n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(ee.hE,{ref:t,className:S("text-lg font-semibold leading-none tracking-tight",i),...n})});el.displayName=ee.hE.displayName;let ed=n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(ee.VY,{ref:t,className:S("text-sm text-muted-foreground",i),...n})});function em(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M12 .5C5.48.5.5 5.48.5 12c0 5.08 3.29 9.35 7.85 10.86.58.1.79-.24.79-.54 0-.27-.01-.99-.01-1.94-3.19.69-3.86-1.54-3.86-1.54-.53-1.36-1.29-1.72-1.29-1.72-1.05-.72.08-.71.08-.71 1.16.08 1.77 1.2 1.77 1.2 1.03 1.77 2.69 1.26 3.34.96.1-.75.4-1.26.73-1.55-2.55-.29-5.23-1.28-5.23-5.72 0-1.26.45-2.29 1.2-3.1-.12-.29-.52-1.45.12-3.02 0 0 .97-.31 3.17 1.18.92-.26 1.91-.39 2.89-.39.98 0 1.97.13 2.89.39 2.2-1.49 3.17-1.18 3.17-1.18.64 1.57.24 2.73.12 3.02.75.81 1.2 1.84 1.2 3.1 0 4.46-2.69 5.43-5.25 5.71.41.35.78 1.03.78 2.08 0 1.5-.01 2.72-.01 3.08 0 .3.21.65.8.54C20.71 21.35 24 17.08 24 12c0-6.52-4.98-11.5-12-11.5z"})})}function ec(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M12 12.713l11.985-8.677a.868.868 0 0 0-.491-.148H.506c-.177 0-.344.055-.491.148L12 12.713zm0 1.431L.035 5.596A.875.875 0 0 0 0 6.125v11.75c0 .478.387.875.875.875h22.25c.478 0 .875-.387.875-.875V6.125a.875.875 0 0 0-.035-.529L12 14.144z"})})}function ep(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.761 0 5-2.239 5-5v-14c0-2.761-2.239-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.5c-.966 0-1.75-.784-1.75-1.75s.784-1.75 1.75-1.75 1.75.784 1.75 1.75-.784 1.75-1.75 1.75zm13.5 12.5h-3v-5.5c0-1.379-1.121-2.5-2.5-2.5s-2.5 1.121-2.5 2.5v5.5h-3v-11h3v1.474c.809-1.161 2.201-1.974 3.5-1.974 2.481 0 4.5 2.019 4.5 4.5v7z"})})}function eu(e){let{year:t,rightsLabel:i,licenseLabel:n,viewLicenseLabel:a,lang:o,onLangChange:s}=e;return(0,r.jsx)("footer",{className:"border-t border-border bg-card/40 py-6 mt-16",children:(0,r.jsxs)("div",{className:"container mx-auto max-w-6xl px-4 md:px-6 flex flex-wrap items-center justify-between gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:["\xa9 ",t," Quintavalle Pietro. ",i]}),(0,r.jsxs)("nav",{className:"flex items-center gap-4",children:[(0,r.jsx)($,{value:o,onChange:s}),(0,r.jsxs)(ei,{children:[(0,r.jsx)(er,{className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:a}),(0,r.jsx)(eo,{children:(0,r.jsxs)(es,{children:[(0,r.jsx)(el,{children:n}),(0,r.jsx)(ed,{asChild:!0,children:(0,r.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,r.jsx)("p",{className:"font-semibold text-foreground",children:"Copyright (c) 2024 Quintavalle Pietro"}),(0,r.jsx)("p",{children:'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:'}),(0,r.jsx)("p",{children:"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software."}),(0,r.jsx)("p",{children:'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.'})]})})]})})]}),(0,r.jsx)("a",{href:"https://github.com/Quinta0",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,r.jsx)(em,{className:"w-5 h-5"})}),(0,r.jsx)("a",{href:"mailto:0pietroquintavalle0@gmail.com",className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,r.jsx)(ec,{className:"w-5 h-5"})}),(0,r.jsx)("a",{href:"https://www.linkedin.com/in/pietro-quintavalle-996b96267/",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,r.jsx)(ep,{className:"w-5 h-5"})})]})]})})}ed.displayName=ee.VY.displayName;let eg={slow:260,normal:120,fast:55,turbo:18};function eh(e){return Array.from({length:e},()=>Math.floor(100*Math.random())+1)}function ef(e){return(0,r.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",...e,children:[(0,r.jsx)("rect",{x:"2",y:"11",width:"4",height:"7",rx:"1",fill:"currentColor",opacity:"0.5"}),(0,r.jsx)("rect",{x:"8",y:"6",width:"4",height:"12",rx:"1",fill:"currentColor",opacity:"0.75"}),(0,r.jsx)("rect",{x:"14",y:"2",width:"4",height:"16",rx:"1",fill:"currentColor"})]})}function ev(){var e,t,i,o,m,c,p,f,b;let[y,k]=(0,n.useState)("bubble"),[w,S]=(0,n.useState)("en"),[j,T]=(0,n.useState)(24),[z,E]=(0,n.useState)(()=>Array.from({length:24},(e,t)=>37*t%100+1)),[P,R]=(0,n.useState)([]),[A,L]=(0,n.useState)(0),[I,M]=(0,n.useState)(!1),[q,B]=(0,n.useState)("normal"),H=(0,n.useRef)(null);(0,n.useEffect)(()=>{E(eh(j))},[]),(0,n.useEffect)(()=>{R(s[y](z)),L(0),M(!1)},[y,z]),(0,n.useEffect)(()=>()=>{H.current&&clearTimeout(H.current)},[]),(0,n.useEffect)(()=>{if(I)return A>=P.length-1?void M(!1):(H.current=setTimeout(()=>{L(e=>Math.min(e+1,P.length-1))},eg[q]),()=>{H.current&&clearTimeout(H.current)})},[I,A,P.length,q]);let F=(0,n.useCallback)(()=>{A>=P.length-1&&L(0),M(e=>!e)},[A,P.length]),V=(0,n.useCallback)(()=>{E(eh(j))},[j]),W=(0,n.useCallback)(()=>{E(eh(j))},[j]),U=(0,n.useCallback)(e=>{T(e),E(eh(e))},[]),G=(0,n.useCallback)(e=>{M(!1),L(Math.min(e,P.length-1))},[P.length]),Z=P[A],Q=null!=(i=null==(e=l[y])?void 0:e[w])?i:null==(t=l[y])?void 0:t.en,Y=d[y],J=(0,n.useMemo)(()=>{if(Z&&("select-pivot"===Z.action||"pivot-placed"===Z.action))return Z.indices[0]},[Z]),_=(0,n.useMemo)(()=>{var e;return Z?function(e,t,i,r){var n,a,o,s,l,d,m,c,p,u,f,v,b,x,y;let k=null!=(c=h[r])?c:h.en,w=e.array,[S,C]=e.indices,O=void 0!==S?w[S]:void 0,j=void 0!==C?w[C]:void 0,N={n:w.length,algo:i,a:S,b:C,va:null!=O?O:"",vb:null!=j?j:"",low:null!=(p=null==(n=e.range)?void 0:n[0])?p:"",high:null!=(u=null==(a=e.range)?void 0:a[1])?u:"",mid:null!=(f=null==(o=e.meta)?void 0:o.mid)?f:"",mid1:(null!=(v=null==(s=e.meta)?void 0:s.mid)?v:0)+1,gap:null!=(b=null==(l=e.meta)?void 0:l.gap)?b:"",digit:null!=(x=null==(d=e.meta)?void 0:d.digit)?x:"",bucket:null!=(y=null==(m=e.meta)?void 0:m.bucket)?y:""};switch(e.action){case"init":return g(k.init,N);case"compare":return g(k.compare,N);case"swap":return g(k.swapYes,N);case"overwrite":return g(k.overwrite,N);case"shift":return g(k.shift,N);case"select-pivot":return g(k.selectPivot,N);case"partition-range":return g(k.partitionRange,N);case"pivot-placed":return g(k.pivotPlaced,N);case"merge-range":return g(k.mergeRange,N);case"merge-write":return g(k.mergeWrite,N);case"mark-sorted":return g(k.markSorted,N);case"gap-set":return"radix"===t?g(k.radixDigit,N):g(k.shellGap,N);case"count":return g(k.countingTally,N);case"bucket-place":return g(k.bucketPlace,N);case"bucket-sorted":return g(k.bucketSorted,N);case"done":return k.done;default:return""}}(Z,y,null!=(e=null==Q?void 0:Q.title)?e:y,w):""},[Z,y,Q,w]);return(0,r.jsxs)("div",{className:"min-h-screen flex flex-col",children:[(0,r.jsx)("header",{className:"sticky top-0 z-40 border-b border-border bg-background/85 backdrop-blur-md",children:(0,r.jsxs)("div",{className:"container mx-auto max-w-6xl px-4 md:px-6 h-16 flex items-center justify-between gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,r.jsx)(ef,{className:"h-5 w-5 shrink-0 text-foreground"}),(0,r.jsx)("h1",{className:"text-base font-semibold tracking-tight truncate",children:u(w,"brand")}),(0,r.jsx)("span",{className:"hidden md:inline text-sm text-muted-foreground ml-2 pl-3 border-l border-border truncate",children:u(w,"tagline")})]}),(0,r.jsx)(X,{value:y,onChange:k,triggerLabel:u(w,"pickAlgorithm")})]})}),(0,r.jsxs)("main",{className:"flex-1",children:[(0,r.jsx)(a.P.section,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.4},className:"border-b border-border bg-card/30",children:(0,r.jsx)("div",{className:"container mx-auto max-w-6xl px-4 md:px-6 py-8 md:py-10",children:(0,r.jsx)(v,{values:null!=(o=null==Z?void 0:Z.array)?o:z,indices:null!=(m=null==Z?void 0:Z.indices)?m:[],action:null==Z?void 0:Z.action,sorted:null!=(c=null==Z?void 0:Z.sorted)?c:[],range:null==Z?void 0:Z.range,pivotIndex:J,stepDurationMs:eg[q]})})}),(0,r.jsx)("div",{className:"container mx-auto max-w-6xl px-4 md:px-6 py-8 md:py-10",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,r.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,r.jsx)(O,{text:_,stepIndex:A,title:u(w,"narrationTitle")}),(0,r.jsx)(D,{isPlaying:I,onTogglePlay:F,onShuffle:V,onReset:W,arraySize:j,onArraySizeChange:U,speed:q,onSpeedChange:B,stepIndex:A,stepCount:Math.max(P.length-1,0),onScrub:G,labels:{play:u(w,"play"),pause:u(w,"pause"),shuffle:u(w,"shuffle"),reset:u(w,"reset"),arraySize:u(w,"arraySize"),elements:u(w,"elements"),speed:u(w,"speed"),speedSlow:u(w,"speedSlow"),speedNormal:u(w,"speedNormal"),speedFast:u(w,"speedFast"),speedTurbo:u(w,"speedTurbo")}})]}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(N,{title:u(w,"statsTitle"),comparisons:null!=(p=null==Z?void 0:Z.comparisons)?p:0,writes:null!=(f=null==Z?void 0:Z.writes)?f:0,stepLabel:u(w,"step"),stepIndex:A,stepCount:Math.max(P.length-1,0),sortedLabel:u(w,"sorted"),sortedCount:null!=(b=null==Z?void 0:Z.sorted.length)?b:0,total:z.length}),Q&&(0,r.jsxs)(C,{children:[(0,r.jsx)("h2",{className:"text-xl font-semibold tracking-tight",children:Q.title}),(0,r.jsxs)("div",{className:"mt-1 space-y-0.5",children:[(0,r.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:Q.timeComplexity}),(0,r.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:Q.spaceComplexity})]}),(0,r.jsx)("p",{className:"mt-4 text-sm text-muted-foreground leading-relaxed",children:Q.description})]}),(0,r.jsxs)(C,{children:[(0,r.jsx)("p",{className:"text-xs uppercase tracking-widest text-muted-foreground mb-1",children:u(w,"growthTitle")}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-4",children:u(w,"growthCaption")}),(0,r.jsx)(x,{active:Y,n:j,maxN:100,labels:{"n+k":"O(n + k)",nlogn:"O(n log n)","n2-adaptive":"O(n log\xb2 n)",n2:"O(n\xb2)"}})]})]})]})})]}),(0,r.jsx)(eu,{year:2024,rightsLabel:u(w,"footerRights"),licenseLabel:u(w,"license"),viewLicenseLabel:u(w,"viewLicense"),lang:w,onLangChange:S})]})}},3538:(e,t,i)=>{Promise.resolve().then(i.bind(i,2871))}},e=>{e.O(0,[367,441,255,358],()=>e(e.s=3538)),_N_E=e.O()}]);