@nice2dev/ui-math 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- var pe = Object.defineProperty;
2
- var ue = (e, t, r) => t in e ? pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var T = (e, t, r) => ue(e, typeof t != "symbol" ? t + "" : t, r);
1
+ var me = Object.defineProperty;
2
+ var ue = (e, t, r) => t in e ? me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var z = (e, t, r) => ue(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { jsx as d, jsxs as v, Fragment as oe } from "react/jsx-runtime";
5
- import { NiceAppShell as ge, NiceIcon as X } from "@nice2dev/ui";
6
- import { NiceTutorialButton as xe, resolveTutorial as me, resolveCssColor as I, NiceIcon as G } from "@nice2dev/ui-core";
7
- import ye, { useMemo as he, useContext as j, createContext as F, useState as P, useRef as U, useCallback as R, useEffect as V } from "react";
8
- const J = {
5
+ import { NiceAppShell as ye, NiceIcon as N } from "@nice2dev/ui";
6
+ import { useNiceTranslation as xe, NiceTutorialButton as he, resolveTutorial as fe, clickOnActivationKey as be, resolveCssColor as D, NiceIcon as j } from "@nice2dev/ui-core";
7
+ import ve, { useMemo as ae, useContext as F, createContext as O, useState as M, useRef as U, useCallback as R, useEffect as Y } from "react";
8
+ const V = {
9
9
  en: {
10
10
  "calculator.matrixA": "Matrix A",
11
11
  "calculator.matrixB": "Matrix B",
@@ -26,7 +26,44 @@ const J = {
26
26
  "editor.handwritingNote": "Draw your equation above. Handwriting recognition requires external API integration.",
27
27
  "editor.templates": "Templates",
28
28
  "editor.copyLatex": "Copy LaTeX",
29
- "plotter.close": "Close"
29
+ "plotter.close": "Close",
30
+ "calculator.standard": "Standard",
31
+ "calculator.scientific": "Scientific",
32
+ "calculator.programmer": "Programmer",
33
+ "calculator.matrix": "Matrix",
34
+ "calculator.calculus": "Calculus",
35
+ "calculator.units": "Units",
36
+ "geometry.select": "Select",
37
+ "geometry.point": "Point",
38
+ "geometry.segment": "Segment",
39
+ "geometry.line": "Line",
40
+ "geometry.ray": "Ray",
41
+ "geometry.circle": "Circle",
42
+ "geometry.polygon": "Polygon",
43
+ "geometry.perpendicular": "Perpendicular",
44
+ "geometry.parallel": "Parallel",
45
+ "geometry.midpoint": "Midpoint",
46
+ "geometry.angleBisector": "Angle Bisector",
47
+ "geometry.intersection": "Intersection",
48
+ "geometry.reflect": "Reflect",
49
+ "geometry.rotate": "Rotate",
50
+ "geometry.measure": "Measure",
51
+ "geometry.arc": "Arc",
52
+ "geometry.angle": "Angle",
53
+ "geometry.tangent": "Tangent",
54
+ "geometry.translate": "Translate",
55
+ "geometry.dilate": "Dilate",
56
+ "geometry.text": "Text",
57
+ "geometry.tool": "Tool: {tool}",
58
+ "geometry.objects": "Objects: {elements}",
59
+ "geometry.points": "Points: {pointCount}",
60
+ "geometry.scaleX": "Scale: {scale}x",
61
+ "plotter.parametricXTYT": "Parametric (x(t), y(t))",
62
+ "plotter.polarRF": "Polar r = f(θ)",
63
+ "plotter.n3dSurfaceZFX": "3D Surface z = f(x,y)",
64
+ "plotter.expression": "Expression...",
65
+ "plotter.addPlot": "+ Add Plot",
66
+ "editor.previewRequiresKatexMathjaxIntegration": "Preview (requires KaTeX/MathJax integration):"
30
67
  },
31
68
  pl: {
32
69
  "calculator.matrixA": "Macierz A",
@@ -48,7 +85,44 @@ const J = {
48
85
  "editor.handwritingNote": "Narysuj równanie powyżej. Rozpoznawanie pisma wymaga zewnętrznej integracji API.",
49
86
  "editor.templates": "Szablony",
50
87
  "editor.copyLatex": "Kopiuj LaTeX",
51
- "plotter.close": "Zamknij"
88
+ "plotter.close": "Zamknij",
89
+ "calculator.standard": "Standardowy",
90
+ "calculator.scientific": "Naukowy",
91
+ "calculator.programmer": "Programisty",
92
+ "calculator.matrix": "Macierze",
93
+ "calculator.calculus": "Analiza",
94
+ "calculator.units": "Jednostki",
95
+ "geometry.select": "Zaznacz",
96
+ "geometry.point": "Punkt",
97
+ "geometry.segment": "Odcinek",
98
+ "geometry.line": "Prosta",
99
+ "geometry.ray": "Półprosta",
100
+ "geometry.circle": "Okrąg",
101
+ "geometry.polygon": "Wielokąt",
102
+ "geometry.perpendicular": "Prostopadła",
103
+ "geometry.parallel": "Równoległa",
104
+ "geometry.midpoint": "Środek odcinka",
105
+ "geometry.angleBisector": "Dwusieczna kąta",
106
+ "geometry.intersection": "Przecięcie",
107
+ "geometry.reflect": "Odbicie",
108
+ "geometry.rotate": "Obrót",
109
+ "geometry.measure": "Pomiar",
110
+ "geometry.arc": "Łuk",
111
+ "geometry.angle": "Kąt",
112
+ "geometry.tangent": "Styczna",
113
+ "geometry.translate": "Przesunięcie",
114
+ "geometry.dilate": "Jednokładność",
115
+ "geometry.text": "Tekst",
116
+ "geometry.tool": "Narzędzie: {tool}",
117
+ "geometry.objects": "Obiekty: {elements}",
118
+ "geometry.points": "Punkty: {pointCount}",
119
+ "geometry.scaleX": "Skala: {scale}x",
120
+ "plotter.parametricXTYT": "Parametryczny (x(t), y(t))",
121
+ "plotter.polarRF": "Biegunowy r = f(θ)",
122
+ "plotter.n3dSurfaceZFX": "Powierzchnia 3D z = f(x,y)",
123
+ "plotter.expression": "Wyrażenie...",
124
+ "plotter.addPlot": "+ Dodaj wykres",
125
+ "editor.previewRequiresKatexMathjaxIntegration": "Podgląd (wymaga integracji KaTeX/MathJax):"
52
126
  },
53
127
  de: {
54
128
  "calculator.matrixA": "Matrix A",
@@ -70,7 +144,44 @@ const J = {
70
144
  "editor.handwritingNote": "Zeichnen Sie Ihre Gleichung oben. Die Handschrifterkennung erfordert eine externe API-Integration.",
71
145
  "editor.templates": "Vorlagen",
72
146
  "editor.copyLatex": "LaTeX kopieren",
73
- "plotter.close": "Schließen"
147
+ "plotter.close": "Schließen",
148
+ "calculator.standard": "Standard",
149
+ "calculator.scientific": "Wissenschaftlich",
150
+ "calculator.programmer": "Programmierer",
151
+ "calculator.matrix": "Matrix",
152
+ "calculator.calculus": "Analysis",
153
+ "calculator.units": "Einheiten",
154
+ "geometry.select": "Auswählen",
155
+ "geometry.point": "Punkt",
156
+ "geometry.segment": "Strecke",
157
+ "geometry.line": "Gerade",
158
+ "geometry.ray": "Strahl",
159
+ "geometry.circle": "Kreis",
160
+ "geometry.polygon": "Polygon",
161
+ "geometry.perpendicular": "Senkrechte",
162
+ "geometry.parallel": "Parallele",
163
+ "geometry.midpoint": "Mittelpunkt",
164
+ "geometry.angleBisector": "Winkelhalbierende",
165
+ "geometry.intersection": "Schnittpunkt",
166
+ "geometry.reflect": "Spiegeln",
167
+ "geometry.rotate": "Drehen",
168
+ "geometry.measure": "Messen",
169
+ "geometry.arc": "Bogen",
170
+ "geometry.angle": "Winkel",
171
+ "geometry.tangent": "Tangente",
172
+ "geometry.translate": "Verschieben",
173
+ "geometry.dilate": "Strecken",
174
+ "geometry.text": "Text",
175
+ "geometry.tool": "Werkzeug: {tool}",
176
+ "geometry.objects": "Objekte: {elements}",
177
+ "geometry.points": "Punkte: {pointCount}",
178
+ "geometry.scaleX": "Maßstab: {scale}x",
179
+ "plotter.parametricXTYT": "Parametrisch (x(t), y(t))",
180
+ "plotter.polarRF": "Polar r = f(θ)",
181
+ "plotter.n3dSurfaceZFX": "3D-Fläche z = f(x,y)",
182
+ "plotter.expression": "Ausdruck...",
183
+ "plotter.addPlot": "+ Diagramm hinzufügen",
184
+ "editor.previewRequiresKatexMathjaxIntegration": "Vorschau (erfordert KaTeX/MathJax-Integration):"
74
185
  },
75
186
  fr: {
76
187
  "calculator.matrixA": "Matrice A",
@@ -92,7 +203,44 @@ const J = {
92
203
  "editor.handwritingNote": "Dessinez votre équation ci-dessus. La reconnaissance d'écriture nécessite une intégration API externe.",
93
204
  "editor.templates": "Modèles",
94
205
  "editor.copyLatex": "Copier le LaTeX",
95
- "plotter.close": "Fermer"
206
+ "plotter.close": "Fermer",
207
+ "calculator.standard": "Standard",
208
+ "calculator.scientific": "Scientifique",
209
+ "calculator.programmer": "Programmeur",
210
+ "calculator.matrix": "Matrice",
211
+ "calculator.calculus": "Analyse",
212
+ "calculator.units": "Unités",
213
+ "geometry.select": "Sélectionner",
214
+ "geometry.point": "Point",
215
+ "geometry.segment": "Segment",
216
+ "geometry.line": "Droite",
217
+ "geometry.ray": "Demi-droite",
218
+ "geometry.circle": "Cercle",
219
+ "geometry.polygon": "Polygone",
220
+ "geometry.perpendicular": "Perpendiculaire",
221
+ "geometry.parallel": "Parallèle",
222
+ "geometry.midpoint": "Milieu",
223
+ "geometry.angleBisector": "Bissectrice",
224
+ "geometry.intersection": "Intersection",
225
+ "geometry.reflect": "Réflexion",
226
+ "geometry.rotate": "Rotation",
227
+ "geometry.measure": "Mesurer",
228
+ "geometry.arc": "Arc",
229
+ "geometry.angle": "Angle",
230
+ "geometry.tangent": "Tangente",
231
+ "geometry.translate": "Translation",
232
+ "geometry.dilate": "Homothétie",
233
+ "geometry.text": "Texte",
234
+ "geometry.tool": "Outil : {tool}",
235
+ "geometry.objects": "Objets : {elements}",
236
+ "geometry.points": "Points : {pointCount}",
237
+ "geometry.scaleX": "Échelle : {scale}x",
238
+ "plotter.parametricXTYT": "Paramétrique (x(t), y(t))",
239
+ "plotter.polarRF": "Polaire r = f(θ)",
240
+ "plotter.n3dSurfaceZFX": "Surface 3D z = f(x,y)",
241
+ "plotter.expression": "Expression...",
242
+ "plotter.addPlot": "+ Ajouter un tracé",
243
+ "editor.previewRequiresKatexMathjaxIntegration": "Aperçu (nécessite l'intégration KaTeX/MathJax) :"
96
244
  },
97
245
  es: {
98
246
  "calculator.matrixA": "Matriz A",
@@ -114,7 +262,44 @@ const J = {
114
262
  "editor.handwritingNote": "Dibuja tu ecuación arriba. El reconocimiento de escritura requiere integración con una API externa.",
115
263
  "editor.templates": "Plantillas",
116
264
  "editor.copyLatex": "Copiar LaTeX",
117
- "plotter.close": "Cerrar"
265
+ "plotter.close": "Cerrar",
266
+ "calculator.standard": "Estándar",
267
+ "calculator.scientific": "Científica",
268
+ "calculator.programmer": "Programador",
269
+ "calculator.matrix": "Matriz",
270
+ "calculator.calculus": "Cálculo",
271
+ "calculator.units": "Unidades",
272
+ "geometry.select": "Seleccionar",
273
+ "geometry.point": "Punto",
274
+ "geometry.segment": "Segmento",
275
+ "geometry.line": "Recta",
276
+ "geometry.ray": "Semirrecta",
277
+ "geometry.circle": "Circunferencia",
278
+ "geometry.polygon": "Polígono",
279
+ "geometry.perpendicular": "Perpendicular",
280
+ "geometry.parallel": "Paralela",
281
+ "geometry.midpoint": "Punto medio",
282
+ "geometry.angleBisector": "Bisectriz",
283
+ "geometry.intersection": "Intersección",
284
+ "geometry.reflect": "Reflejar",
285
+ "geometry.rotate": "Girar",
286
+ "geometry.measure": "Medir",
287
+ "geometry.arc": "Arco",
288
+ "geometry.angle": "Ángulo",
289
+ "geometry.tangent": "Tangente",
290
+ "geometry.translate": "Trasladar",
291
+ "geometry.dilate": "Homotecia",
292
+ "geometry.text": "Texto",
293
+ "geometry.tool": "Herramienta: {tool}",
294
+ "geometry.objects": "Objetos: {elements}",
295
+ "geometry.points": "Puntos: {pointCount}",
296
+ "geometry.scaleX": "Escala: {scale}x",
297
+ "plotter.parametricXTYT": "Paramétrica (x(t), y(t))",
298
+ "plotter.polarRF": "Polar r = f(θ)",
299
+ "plotter.n3dSurfaceZFX": "Superficie 3D z = f(x,y)",
300
+ "plotter.expression": "Expresión...",
301
+ "plotter.addPlot": "+ Añadir gráfica",
302
+ "editor.previewRequiresKatexMathjaxIntegration": "Vista previa (requiere integración con KaTeX/MathJax):"
118
303
  },
119
304
  it: {
120
305
  "calculator.matrixA": "Matrice A",
@@ -136,7 +321,44 @@ const J = {
136
321
  "editor.handwritingNote": "Disegna la tua equazione qui sopra. Il riconoscimento della scrittura richiede un’integrazione API esterna.",
137
322
  "editor.templates": "Modelli",
138
323
  "editor.copyLatex": "Copia LaTeX",
139
- "plotter.close": "Chiudi"
324
+ "plotter.close": "Chiudi",
325
+ "calculator.standard": "Standard",
326
+ "calculator.scientific": "Scientifica",
327
+ "calculator.programmer": "Programmatore",
328
+ "calculator.matrix": "Matrice",
329
+ "calculator.calculus": "Analisi",
330
+ "calculator.units": "Unità",
331
+ "geometry.select": "Seleziona",
332
+ "geometry.point": "Punto",
333
+ "geometry.segment": "Segmento",
334
+ "geometry.line": "Retta",
335
+ "geometry.ray": "Semiretta",
336
+ "geometry.circle": "Circonferenza",
337
+ "geometry.polygon": "Poligono",
338
+ "geometry.perpendicular": "Perpendicolare",
339
+ "geometry.parallel": "Parallela",
340
+ "geometry.midpoint": "Punto medio",
341
+ "geometry.angleBisector": "Bisettrice",
342
+ "geometry.intersection": "Intersezione",
343
+ "geometry.reflect": "Rifletti",
344
+ "geometry.rotate": "Ruota",
345
+ "geometry.measure": "Misura",
346
+ "geometry.arc": "Arco",
347
+ "geometry.angle": "Angolo",
348
+ "geometry.tangent": "Tangente",
349
+ "geometry.translate": "Trasla",
350
+ "geometry.dilate": "Omotetia",
351
+ "geometry.text": "Testo",
352
+ "geometry.tool": "Strumento: {tool}",
353
+ "geometry.objects": "Oggetti: {elements}",
354
+ "geometry.points": "Punti: {pointCount}",
355
+ "geometry.scaleX": "Scala: {scale}x",
356
+ "plotter.parametricXTYT": "Parametrico (x(t), y(t))",
357
+ "plotter.polarRF": "Polare r = f(θ)",
358
+ "plotter.n3dSurfaceZFX": "Superficie 3D z = f(x,y)",
359
+ "plotter.expression": "Espressione...",
360
+ "plotter.addPlot": "+ Aggiungi grafico",
361
+ "editor.previewRequiresKatexMathjaxIntegration": "Anteprima (richiede l'integrazione KaTeX/MathJax):"
140
362
  },
141
363
  pt: {
142
364
  "calculator.matrixA": "Matriz A",
@@ -158,7 +380,44 @@ const J = {
158
380
  "editor.handwritingNote": "Desenhe a sua equação acima. O reconhecimento de escrita requer integração com uma API externa.",
159
381
  "editor.templates": "Modelos",
160
382
  "editor.copyLatex": "Copiar LaTeX",
161
- "plotter.close": "Fechar"
383
+ "plotter.close": "Fechar",
384
+ "calculator.standard": "Padrão",
385
+ "calculator.scientific": "Científica",
386
+ "calculator.programmer": "Programador",
387
+ "calculator.matrix": "Matriz",
388
+ "calculator.calculus": "Cálculo",
389
+ "calculator.units": "Unidades",
390
+ "geometry.select": "Selecionar",
391
+ "geometry.point": "Ponto",
392
+ "geometry.segment": "Segmento",
393
+ "geometry.line": "Reta",
394
+ "geometry.ray": "Semirreta",
395
+ "geometry.circle": "Circunferência",
396
+ "geometry.polygon": "Polígono",
397
+ "geometry.perpendicular": "Perpendicular",
398
+ "geometry.parallel": "Paralela",
399
+ "geometry.midpoint": "Ponto médio",
400
+ "geometry.angleBisector": "Bissetriz",
401
+ "geometry.intersection": "Interseção",
402
+ "geometry.reflect": "Refletir",
403
+ "geometry.rotate": "Rodar",
404
+ "geometry.measure": "Medir",
405
+ "geometry.arc": "Arco",
406
+ "geometry.angle": "Ângulo",
407
+ "geometry.tangent": "Tangente",
408
+ "geometry.translate": "Transladar",
409
+ "geometry.dilate": "Homotetia",
410
+ "geometry.text": "Texto",
411
+ "geometry.tool": "Ferramenta: {tool}",
412
+ "geometry.objects": "Objetos: {elements}",
413
+ "geometry.points": "Pontos: {pointCount}",
414
+ "geometry.scaleX": "Escala: {scale}x",
415
+ "plotter.parametricXTYT": "Paramétrico (x(t), y(t))",
416
+ "plotter.polarRF": "Polar r = f(θ)",
417
+ "plotter.n3dSurfaceZFX": "Superfície 3D z = f(x,y)",
418
+ "plotter.expression": "Expressão...",
419
+ "plotter.addPlot": "+ Adicionar gráfico",
420
+ "editor.previewRequiresKatexMathjaxIntegration": "Pré-visualização (requer integração KaTeX/MathJax):"
162
421
  },
163
422
  cs: {
164
423
  "calculator.matrixA": "Matice A",
@@ -180,7 +439,44 @@ const J = {
180
439
  "editor.handwritingNote": "Nakreslete svou rovnici výše. Rozpoznávání rukopisu vyžaduje externí integraci API.",
181
440
  "editor.templates": "Šablony",
182
441
  "editor.copyLatex": "Kopírovat LaTeX",
183
- "plotter.close": "Zavřít"
442
+ "plotter.close": "Zavřít",
443
+ "calculator.standard": "Standardní",
444
+ "calculator.scientific": "Vědecká",
445
+ "calculator.programmer": "Programátorská",
446
+ "calculator.matrix": "Matice",
447
+ "calculator.calculus": "Analýza",
448
+ "calculator.units": "Jednotky",
449
+ "geometry.select": "Vybrat",
450
+ "geometry.point": "Bod",
451
+ "geometry.segment": "Úsečka",
452
+ "geometry.line": "Přímka",
453
+ "geometry.ray": "Polopřímka",
454
+ "geometry.circle": "Kružnice",
455
+ "geometry.polygon": "Mnohoúhelník",
456
+ "geometry.perpendicular": "Kolmice",
457
+ "geometry.parallel": "Rovnoběžka",
458
+ "geometry.midpoint": "Střed",
459
+ "geometry.angleBisector": "Osa úhlu",
460
+ "geometry.intersection": "Průsečík",
461
+ "geometry.reflect": "Zrcadlit",
462
+ "geometry.rotate": "Otočit",
463
+ "geometry.measure": "Měřit",
464
+ "geometry.arc": "Oblouk",
465
+ "geometry.angle": "Úhel",
466
+ "geometry.tangent": "Tečna",
467
+ "geometry.translate": "Posunout",
468
+ "geometry.dilate": "Stejnolehlost",
469
+ "geometry.text": "Text",
470
+ "geometry.tool": "Nástroj: {tool}",
471
+ "geometry.objects": "Objekty: {elements}",
472
+ "geometry.points": "Body: {pointCount}",
473
+ "geometry.scaleX": "Měřítko: {scale}x",
474
+ "plotter.parametricXTYT": "Parametrický (x(t), y(t))",
475
+ "plotter.polarRF": "Polární r = f(θ)",
476
+ "plotter.n3dSurfaceZFX": "3D plocha z = f(x,y)",
477
+ "plotter.expression": "Výraz...",
478
+ "plotter.addPlot": "+ Přidat graf",
479
+ "editor.previewRequiresKatexMathjaxIntegration": "Náhled (vyžaduje integraci KaTeX/MathJax):"
184
480
  },
185
481
  uk: {
186
482
  "calculator.matrixA": "Матриця A",
@@ -202,23 +498,59 @@ const J = {
202
498
  "editor.handwritingNote": "Намалюйте своє рівняння вище. Розпізнавання рукопису потребує зовнішньої інтеграції з API.",
203
499
  "editor.templates": "Шаблони",
204
500
  "editor.copyLatex": "Копіювати LaTeX",
205
- "plotter.close": "Закрити"
206
- }
207
- }, ae = /* @__PURE__ */ F({
208
- locale: "en",
209
- t: (e, t) => t ?? e
210
- });
211
- function Qe({ locale: e = "en", overrides: t, children: r }) {
212
- const o = he(() => {
213
- const a = { ...J.en, ...J[e], ...t };
214
- return { locale: e, t: (i, c) => a[i] ?? c ?? i };
215
- }, [e, t]);
216
- return ye.createElement(ae.Provider, { value: o }, r);
501
+ "plotter.close": "Закрити",
502
+ "calculator.standard": "Стандартний",
503
+ "calculator.scientific": "Науковий",
504
+ "calculator.programmer": "Програміста",
505
+ "calculator.matrix": "Матриці",
506
+ "calculator.calculus": "Аналіз",
507
+ "calculator.units": "Одиниці",
508
+ "geometry.select": "Вибрати",
509
+ "geometry.point": "Точка",
510
+ "geometry.segment": "Відрізок",
511
+ "geometry.line": "Пряма",
512
+ "geometry.ray": "Промінь",
513
+ "geometry.circle": "Коло",
514
+ "geometry.polygon": "Многокутник",
515
+ "geometry.perpendicular": "Перпендикуляр",
516
+ "geometry.parallel": "Паралельна",
517
+ "geometry.midpoint": "Середина",
518
+ "geometry.angleBisector": "Бісектриса",
519
+ "geometry.intersection": "Перетин",
520
+ "geometry.reflect": "Відбити",
521
+ "geometry.rotate": "Повернути",
522
+ "geometry.measure": "Виміряти",
523
+ "geometry.arc": "Дуга",
524
+ "geometry.angle": "Кут",
525
+ "geometry.tangent": "Дотична",
526
+ "geometry.translate": "Перенести",
527
+ "geometry.dilate": "Гомотетія",
528
+ "geometry.text": "Текст",
529
+ "geometry.tool": "Інструмент: {tool}",
530
+ "geometry.objects": "Об'єкти: {elements}",
531
+ "geometry.points": "Точки: {pointCount}",
532
+ "geometry.scaleX": "Масштаб: {scale}x",
533
+ "plotter.parametricXTYT": "Параметричний (x(t), y(t))",
534
+ "plotter.polarRF": "Полярний r = f(θ)",
535
+ "plotter.n3dSurfaceZFX": "3D-поверхня z = f(x,y)",
536
+ "plotter.expression": "Вираз...",
537
+ "plotter.addPlot": "+ Додати графік",
538
+ "editor.previewRequiresKatexMathjaxIntegration": "Попередній перегляд (потрібна інтеграція KaTeX/MathJax):"
539
+ }
540
+ }, ne = /* @__PURE__ */ O(null);
541
+ function ie(e, t) {
542
+ const r = { ...V.en, ...V[e], ...t };
543
+ return { locale: e, t: (a, n) => r[a] ?? n ?? a };
544
+ }
545
+ function tt({ locale: e = "en", overrides: t, children: r }) {
546
+ const o = ae(() => ie(e, t), [e, t]);
547
+ return ve.createElement(ne.Provider, { value: o }, r);
217
548
  }
218
- function L() {
219
- return j(ae);
549
+ function E() {
550
+ const e = F(ne), { lang: t } = xe(), r = V[t] ? t : "en", o = ae(() => ie(r), [r]);
551
+ return e ?? o;
220
552
  }
221
- const fe = [
553
+ const we = [
222
554
  {
223
555
  target: ".nice-math-editor",
224
556
  titleKey: "tutorial.mathEditor.intro.title",
@@ -227,7 +559,7 @@ const fe = [
227
559
  content: "Write equations as LaTeX or insert symbols from the palette; switch to handwriting input, and preview the rendered formula live.",
228
560
  placement: "auto"
229
561
  }
230
- ], be = [
562
+ ], ke = [
231
563
  // Greek lowercase
232
564
  { name: "alpha", latex: "\\alpha", category: "greek", preview: "α" },
233
565
  { name: "beta", latex: "\\beta", category: "greek", preview: "β" },
@@ -404,10 +736,10 @@ const fe = [
404
736
  preview: "{ }"
405
737
  }
406
738
  ];
407
- function ve(e) {
408
- return be.filter((t) => t.category === e);
739
+ function Pe(e) {
740
+ return ke.filter((t) => t.category === e);
409
741
  }
410
- const we = [
742
+ const Me = [
411
743
  // Basic
412
744
  { name: "Fraction", latex: "\\frac{a}{b}", category: "basic" },
413
745
  { name: "Square root", latex: "\\sqrt{x}", category: "basic" },
@@ -466,11 +798,11 @@ const we = [
466
798
  category: "physics"
467
799
  }
468
800
  ];
469
- class ke {
801
+ class Ce {
470
802
  constructor(t = {}) {
471
- T(this, "equations", /* @__PURE__ */ new Map());
472
- T(this, "config");
473
- T(this, "nextNumber");
803
+ z(this, "equations", /* @__PURE__ */ new Map());
804
+ z(this, "config");
805
+ z(this, "nextNumber");
474
806
  this.config = {
475
807
  enableNumbering: t.enableNumbering ?? !0,
476
808
  startNumber: t.startNumber ?? 1,
@@ -539,8 +871,8 @@ class ke {
539
871
  r.push(this.createEquation(a[1].trim()));
540
872
  const n = /\\begin\{equation\}([\s\S]*?)\\end\{equation\}/g;
541
873
  for (; (a = n.exec(t)) !== null; ) {
542
- const i = a[1].match(/\\label\{([^}]+)\}/), c = a[1].replace(/\\label\{[^}]+\}/, "").trim();
543
- r.push(this.createEquation(c, i == null ? void 0 : i[1]));
874
+ const i = a[1].match(/\\label\{([^}]+)\}/), l = a[1].replace(/\\label\{[^}]+\}/, "").trim();
875
+ r.push(this.createEquation(l, i == null ? void 0 : i[1]));
544
876
  }
545
877
  return r;
546
878
  }
@@ -548,19 +880,19 @@ class ke {
548
880
  return Date.now().toString(36) + Math.random().toString(36).substring(2, 8);
549
881
  }
550
882
  }
551
- function Je(e) {
552
- return new ke(e);
883
+ function rt(e) {
884
+ return new Ce(e);
553
885
  }
554
- async function Ce(e) {
886
+ async function Se(e) {
555
887
  return await new Promise((r) => setTimeout(r, 500)), {
556
888
  latex: e.reduce((r, o) => r + o.points.length, 0) > 50 ? "\\sqrt{x^2 + y^2}" : "x",
557
889
  confidence: 0.85,
558
890
  alternatives: ["x", "X", "\\times"]
559
891
  };
560
892
  }
561
- const ne = /* @__PURE__ */ F(null);
893
+ const se = /* @__PURE__ */ O(null);
562
894
  function W() {
563
- const e = j(ne);
895
+ const e = F(se);
564
896
  if (!e)
565
897
  throw new Error("useMathEditor must be used within MathEditorProvider");
566
898
  return e;
@@ -648,7 +980,7 @@ const A = {
648
980
  cursor: "crosshair"
649
981
  }
650
982
  };
651
- function et({
983
+ function ot({
652
984
  service: e,
653
985
  initialLatex: t = "",
654
986
  onChange: r,
@@ -656,67 +988,67 @@ function et({
656
988
  style: a,
657
989
  tutorial: n
658
990
  }) {
659
- const { t: i } = L(), [c, u] = P(t), [s, p] = P("input"), m = U(null), y = R(
991
+ const { t: i } = E(), [l, g] = M(t), [s, p] = M("input"), u = U(null), x = R(
660
992
  (b) => {
661
- u(b), r == null || r(b);
993
+ g(b), r == null || r(b);
662
994
  },
663
995
  [r]
664
996
  ), f = R(
665
997
  (b) => {
666
- const l = m.current;
667
- if (!l) {
668
- y(c + b);
998
+ const c = u.current;
999
+ if (!c) {
1000
+ x(l + b);
669
1001
  return;
670
1002
  }
671
- const g = l.selectionStart, w = l.selectionEnd, M = c.slice(0, g) + b + c.slice(w);
672
- y(M), setTimeout(() => {
673
- l.focus(), l.selectionStart = l.selectionEnd = g + b.length;
1003
+ const m = c.selectionStart, k = c.selectionEnd, C = l.slice(0, m) + b + l.slice(k);
1004
+ x(C), setTimeout(() => {
1005
+ c.focus(), c.selectionStart = c.selectionEnd = m + b.length;
674
1006
  }, 0);
675
1007
  },
676
- [c, y]
677
- ), C = R(
1008
+ [l, x]
1009
+ ), w = R(
678
1010
  (b) => {
679
1011
  f(b.latex);
680
1012
  },
681
1013
  [f]
682
- ), x = {
1014
+ ), y = {
683
1015
  service: e,
684
- latex: c,
685
- setLatex: y,
1016
+ latex: l,
1017
+ setLatex: x,
686
1018
  insertSymbol: f,
687
- insertTemplate: C,
1019
+ insertTemplate: w,
688
1020
  mode: s,
689
1021
  setMode: p
690
1022
  };
691
- return /* @__PURE__ */ d(ne.Provider, { value: x, children: /* @__PURE__ */ v(
692
- ge,
1023
+ return /* @__PURE__ */ d(se.Provider, { value: y, children: /* @__PURE__ */ v(
1024
+ ye,
693
1025
  {
694
1026
  flush: !0,
695
1027
  className: `nice-math-editor ${o ?? ""}`,
696
1028
  style: { position: "relative", ...a },
697
- toolbar: /* @__PURE__ */ d(Pe, {}),
698
- sidebar: /* @__PURE__ */ d(Me, {}),
1029
+ toolbar: /* @__PURE__ */ d(Be, {}),
1030
+ sidebar: /* @__PURE__ */ d(Te, {}),
699
1031
  children: [
700
- /* @__PURE__ */ d("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ d(xe, { steps: me(n, fe) }) }),
1032
+ /* @__PURE__ */ d("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ d(he, { steps: fe(n, we) }) }),
701
1033
  /* @__PURE__ */ d("div", { style: A.editor, children: s === "input" ? /* @__PURE__ */ v(oe, { children: [
702
1034
  /* @__PURE__ */ d(
703
1035
  "textarea",
704
1036
  {
705
- ref: m,
706
- value: c,
707
- onChange: (b) => y(b.target.value),
1037
+ ref: u,
1038
+ value: l,
1039
+ onChange: (b) => x(b.target.value),
708
1040
  placeholder: i("editor.latexPlaceholder", "Enter LaTeX equation..."),
709
1041
  style: A.input
710
1042
  }
711
1043
  ),
712
- /* @__PURE__ */ d(Se, { latex: c })
713
- ] }) : /* @__PURE__ */ d(Be, {}) })
1044
+ /* @__PURE__ */ d(Re, { latex: l })
1045
+ ] }) : /* @__PURE__ */ d(ze, {}) })
714
1046
  ]
715
1047
  }
716
1048
  ) });
717
1049
  }
718
- function Pe() {
719
- const { t: e } = L(), { mode: t, setMode: r, latex: o, insertTemplate: a } = W(), [n, i] = P(!1);
1050
+ function Be() {
1051
+ const { t: e } = E(), { mode: t, setMode: r, latex: o, insertTemplate: a } = W(), [n, i] = M(!1);
720
1052
  return /* @__PURE__ */ v("div", { style: A.toolbar, children: [
721
1053
  /* @__PURE__ */ v(
722
1054
  "button",
@@ -729,7 +1061,7 @@ function Pe() {
729
1061
  color: t === "input" ? "var(--nice-color-white, #fff)" : "var(--nice-text-primary, #fff)"
730
1062
  },
731
1063
  children: [
732
- /* @__PURE__ */ d(X, { name: "keyboard", size: 14 }),
1064
+ /* @__PURE__ */ d(N, { name: "keyboard", size: 14 }),
733
1065
  " ",
734
1066
  e("editor.latexInput", "LaTeX Input")
735
1067
  ]
@@ -745,7 +1077,7 @@ function Pe() {
745
1077
  color: t === "handwriting" ? "var(--nice-color-white, #fff)" : "var(--nice-text-primary, #fff)"
746
1078
  },
747
1079
  children: [
748
- /* @__PURE__ */ d(X, { name: "pen", size: 14 }),
1080
+ /* @__PURE__ */ d(N, { name: "pen", size: 14 }),
749
1081
  " ",
750
1082
  e("editor.handwriting", "Handwriting")
751
1083
  ]
@@ -763,11 +1095,11 @@ function Pe() {
763
1095
  ),
764
1096
  /* @__PURE__ */ v("div", { style: { position: "relative" }, children: [
765
1097
  /* @__PURE__ */ v("button", { onClick: () => i(!n), style: A.button, children: [
766
- /* @__PURE__ */ d(X, { name: "ruler", size: 14 }),
1098
+ /* @__PURE__ */ d(N, { name: "ruler", size: 14 }),
767
1099
  " ",
768
1100
  e("editor.templates", "Templates"),
769
1101
  " ",
770
- /* @__PURE__ */ d(X, { name: "chevron-down", size: 12 })
1102
+ /* @__PURE__ */ d(N, { name: "chevron-down", size: 12 })
771
1103
  ] }),
772
1104
  n && /* @__PURE__ */ d(
773
1105
  "div",
@@ -786,13 +1118,16 @@ function Pe() {
786
1118
  overflow: "auto"
787
1119
  },
788
1120
  children: ["basic", "calculus", "algebra", "geometry", "statistics", "physics"].map(
789
- (c) => /* @__PURE__ */ v("div", { children: [
790
- /* @__PURE__ */ d("div", { style: A.categoryHeader, children: c }),
791
- we.filter((u) => u.category === c).map((u) => /* @__PURE__ */ v(
1121
+ (l) => /* @__PURE__ */ v("div", { children: [
1122
+ /* @__PURE__ */ d("div", { style: A.categoryHeader, children: l }),
1123
+ Me.filter((g) => g.category === l).map((g) => /* @__PURE__ */ v(
792
1124
  "div",
793
1125
  {
1126
+ role: "button",
1127
+ tabIndex: 0,
1128
+ onKeyDown: be,
794
1129
  onClick: () => {
795
- a(u), i(!1);
1130
+ a(g), i(!1);
796
1131
  },
797
1132
  style: {
798
1133
  padding: "8px 12px",
@@ -802,7 +1137,7 @@ function Pe() {
802
1137
  onMouseOver: (s) => s.target.style.backgroundColor = "var(--nice-bg-secondary, #f5f5f5)",
803
1138
  onMouseOut: (s) => s.target.style.backgroundColor = "transparent",
804
1139
  children: [
805
- /* @__PURE__ */ d("div", { style: { fontWeight: 500 }, children: u.name }),
1140
+ /* @__PURE__ */ d("div", { style: { fontWeight: 500 }, children: g.name }),
806
1141
  /* @__PURE__ */ v(
807
1142
  "div",
808
1143
  {
@@ -812,16 +1147,16 @@ function Pe() {
812
1147
  fontFamily: "monospace"
813
1148
  },
814
1149
  children: [
815
- u.latex.substring(0, 40),
816
- u.latex.length > 40 ? "..." : ""
1150
+ g.latex.substring(0, 40),
1151
+ g.latex.length > 40 ? "..." : ""
817
1152
  ]
818
1153
  }
819
1154
  )
820
1155
  ]
821
1156
  },
822
- u.name
1157
+ g.name
823
1158
  ))
824
- ] }, c)
1159
+ ] }, l)
825
1160
  )
826
1161
  }
827
1162
  )
@@ -833,7 +1168,7 @@ function Pe() {
833
1168
  onClick: () => navigator.clipboard.writeText(o),
834
1169
  style: { ...A.button, backgroundColor: "var(--nice-success, #4caf50)" },
835
1170
  children: [
836
- /* @__PURE__ */ d(X, { name: "copy", size: 14 }),
1171
+ /* @__PURE__ */ d(N, { name: "copy", size: 14 }),
837
1172
  " ",
838
1173
  e("editor.copyLatex", "Copy LaTeX")
839
1174
  ]
@@ -841,8 +1176,8 @@ function Pe() {
841
1176
  )
842
1177
  ] });
843
1178
  }
844
- function Me() {
845
- const { insertSymbol: e } = W(), [t, r] = P("greek"), o = [
1179
+ function Te() {
1180
+ const { insertSymbol: e } = W(), [t, r] = M("greek"), o = [
846
1181
  "greek",
847
1182
  "operators",
848
1183
  "relations",
@@ -854,7 +1189,7 @@ function Me() {
854
1189
  "logic",
855
1190
  "calculus",
856
1191
  "matrices"
857
- ], a = ve(t);
1192
+ ], a = Pe(t);
858
1193
  return /* @__PURE__ */ v("div", { style: A.sidebar, children: [
859
1194
  /* @__PURE__ */ d("div", { style: { display: "flex", flexWrap: "wrap", padding: "8px", gap: "4px" }, children: o.map((n) => /* @__PURE__ */ d(
860
1195
  "button",
@@ -885,94 +1220,98 @@ function Me() {
885
1220
  )) })
886
1221
  ] });
887
1222
  }
888
- function Se({ latex: e }) {
1223
+ function Re({ latex: e }) {
1224
+ const { t } = E();
889
1225
  return /* @__PURE__ */ v("div", { style: A.preview, children: [
890
1226
  /* @__PURE__ */ d(
891
1227
  "div",
892
1228
  {
893
1229
  style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)", marginBottom: "8px" },
894
- children: "Preview (requires KaTeX/MathJax integration):"
1230
+ children: t(
1231
+ "editor.previewRequiresKatexMathjaxIntegration",
1232
+ "Preview (requires KaTeX/MathJax integration):"
1233
+ )
895
1234
  }
896
1235
  ),
897
1236
  /* @__PURE__ */ d("code", { style: { fontSize: "16px" }, children: e || "(empty)" })
898
1237
  ] });
899
1238
  }
900
- function Be() {
901
- const { t: e } = L(), { setLatex: t, setMode: r } = W(), o = U(null), [a, n] = P([]), [i, c] = P([]), [u, s] = P(!1), [p, m] = P(!1), y = (l) => {
902
- const g = o.current;
903
- if (!g)
1239
+ function ze() {
1240
+ const { t: e } = E(), { setLatex: t, setMode: r } = W(), o = U(null), [a, n] = M([]), [i, l] = M([]), [g, s] = M(!1), [p, u] = M(!1), x = (c) => {
1241
+ const m = o.current;
1242
+ if (!m)
904
1243
  return;
905
1244
  s(!0);
906
- const w = g.getBoundingClientRect();
907
- c([
1245
+ const k = m.getBoundingClientRect();
1246
+ l([
908
1247
  {
909
- x: l.clientX - w.left,
910
- y: l.clientY - w.top,
911
- pressure: l.pressure,
1248
+ x: c.clientX - k.left,
1249
+ y: c.clientY - k.top,
1250
+ pressure: c.pressure,
912
1251
  timestamp: Date.now()
913
1252
  }
914
1253
  ]);
915
- }, f = (l) => {
916
- if (!u)
1254
+ }, f = (c) => {
1255
+ if (!g)
917
1256
  return;
918
- const g = o.current, w = g == null ? void 0 : g.getContext("2d");
919
- if (!g || !w)
1257
+ const m = o.current, k = m == null ? void 0 : m.getContext("2d");
1258
+ if (!m || !k)
920
1259
  return;
921
- const M = g.getBoundingClientRect(), h = {
922
- x: l.clientX - M.left,
923
- y: l.clientY - M.top,
924
- pressure: l.pressure,
1260
+ const C = m.getBoundingClientRect(), h = {
1261
+ x: c.clientX - C.left,
1262
+ y: c.clientY - C.top,
1263
+ pressure: c.pressure,
925
1264
  timestamp: Date.now()
926
1265
  };
927
- if (c((k) => [...k, h]), i.length > 0) {
928
- const k = i[i.length - 1];
929
- w.beginPath(), w.moveTo(k.x, k.y), w.lineTo(h.x, h.y), w.strokeStyle = I("var(--nice-text, #000)", w.canvas), w.lineWidth = 2, w.lineCap = "round", w.stroke();
1266
+ if (l((P) => [...P, h]), i.length > 0) {
1267
+ const P = i[i.length - 1];
1268
+ k.beginPath(), k.moveTo(P.x, P.y), k.lineTo(h.x, h.y), k.strokeStyle = D("var(--nice-text, #000)", k.canvas), k.lineWidth = 2, k.lineCap = "round", k.stroke();
930
1269
  }
931
- }, C = () => {
932
- if (u) {
1270
+ }, w = () => {
1271
+ if (g) {
933
1272
  if (s(!1), i.length > 1) {
934
- const l = {
1273
+ const c = {
935
1274
  id: Date.now().toString(),
936
1275
  points: [...i]
937
1276
  };
938
- n((g) => [...g, l]);
1277
+ n((m) => [...m, c]);
939
1278
  }
940
- c([]);
1279
+ l([]);
941
1280
  }
942
- }, x = () => {
943
- const l = o.current, g = l == null ? void 0 : l.getContext("2d");
944
- g && l && g.clearRect(0, 0, l.width, l.height), n([]);
1281
+ }, y = () => {
1282
+ const c = o.current, m = c == null ? void 0 : c.getContext("2d");
1283
+ m && c && m.clearRect(0, 0, c.width, c.height), n([]);
945
1284
  }, b = async () => {
946
1285
  if (a.length !== 0) {
947
- m(!0);
1286
+ u(!0);
948
1287
  try {
949
- const l = await Ce(a);
950
- t(l.latex), r("input");
1288
+ const c = await Se(a);
1289
+ t(c.latex), r("input");
951
1290
  } finally {
952
- m(!1);
1291
+ u(!1);
953
1292
  }
954
1293
  }
955
1294
  };
956
- return V(() => {
957
- const l = o.current;
958
- l && (l.width = l.offsetWidth, l.height = 200);
1295
+ return Y(() => {
1296
+ const c = o.current;
1297
+ c && (c.width = c.offsetWidth, c.height = 200);
959
1298
  }, []), /* @__PURE__ */ v("div", { children: [
960
1299
  /* @__PURE__ */ d(
961
1300
  "canvas",
962
1301
  {
963
1302
  ref: o,
964
1303
  style: A.canvas,
965
- onPointerDown: y,
1304
+ onPointerDown: x,
966
1305
  onPointerMove: f,
967
- onPointerUp: C,
968
- onPointerLeave: C
1306
+ onPointerUp: w,
1307
+ onPointerLeave: w
969
1308
  }
970
1309
  ),
971
1310
  /* @__PURE__ */ v("div", { style: { display: "flex", gap: "8px", marginTop: "12px" }, children: [
972
1311
  /* @__PURE__ */ d(
973
1312
  "button",
974
1313
  {
975
- onClick: x,
1314
+ onClick: y,
976
1315
  style: { ...A.button, backgroundColor: "var(--nice-danger, #f44336)" },
977
1316
  children: e("editor.clear", "Clear")
978
1317
  }
@@ -993,14 +1332,14 @@ function Be() {
993
1332
  ) })
994
1333
  ] });
995
1334
  }
996
- const $e = {
1335
+ const Ae = {
997
1336
  pi: Math.PI,
998
1337
  PI: Math.PI,
999
1338
  e: Math.E,
1000
1339
  E: Math.E,
1001
1340
  phi: (1 + Math.sqrt(5)) / 2,
1002
1341
  tau: Math.PI * 2
1003
- }, Re = {
1342
+ }, $e = {
1004
1343
  sin: Math.sin,
1005
1344
  cos: Math.cos,
1006
1345
  tan: Math.tan,
@@ -1032,11 +1371,11 @@ const $e = {
1032
1371
  cot: (e) => 1 / Math.tan(e),
1033
1372
  ln: Math.log
1034
1373
  };
1035
- class ie {
1374
+ class le {
1036
1375
  constructor(t = {}) {
1037
- T(this, "pos", 0);
1038
- T(this, "expr", "");
1039
- T(this, "options");
1376
+ z(this, "pos", 0);
1377
+ z(this, "expr", "");
1378
+ z(this, "options");
1040
1379
  this.options = t;
1041
1380
  }
1042
1381
  parse(t) {
@@ -1132,7 +1471,7 @@ class ie {
1132
1471
  case "variable": {
1133
1472
  if (t.name in r)
1134
1473
  return r[t.name];
1135
- const o = this.lookup({ ...$e, ...this.options.constants }, t.name);
1474
+ const o = this.lookup({ ...Ae, ...this.options.constants }, t.name);
1136
1475
  if (o !== void 0)
1137
1476
  return o;
1138
1477
  throw new Error(`Unknown variable: ${t.name}`);
@@ -1157,7 +1496,7 @@ class ie {
1157
1496
  }
1158
1497
  }
1159
1498
  case "call": {
1160
- const o = this.lookup({ ...Re, ...this.options.functions }, t.name);
1499
+ const o = this.lookup({ ...$e, ...this.options.functions }, t.name);
1161
1500
  if (!o)
1162
1501
  throw new Error(`Unknown function: ${t.name}`);
1163
1502
  const a = t.args.map((n) => this.evaluate(n, r));
@@ -1168,11 +1507,11 @@ class ie {
1168
1507
  }
1169
1508
  }
1170
1509
  }
1171
- class Te {
1510
+ class Ie {
1172
1511
  constructor(t = {}) {
1173
- T(this, "plots", /* @__PURE__ */ new Map());
1174
- T(this, "parser", new ie());
1175
- T(this, "config");
1512
+ z(this, "plots", /* @__PURE__ */ new Map());
1513
+ z(this, "parser", new le());
1514
+ z(this, "config");
1176
1515
  this.config = {
1177
1516
  defaultResolution: t.defaultResolution ?? 200,
1178
1517
  maxResolution: t.maxResolution ?? 1e3
@@ -1218,9 +1557,9 @@ class Te {
1218
1557
  }
1219
1558
  /** Compute 2D function points */
1220
1559
  compute2DFunction(t, r, o, a) {
1221
- const n = this.parser.parse(t), i = [], c = (r.max - r.min) / o;
1222
- for (let u = 0; u <= o; u++) {
1223
- const s = r.min + u * c;
1560
+ const n = this.parser.parse(t), i = [], l = (r.max - r.min) / o;
1561
+ for (let g = 0; g <= o; g++) {
1562
+ const s = r.min + g * l;
1224
1563
  try {
1225
1564
  const p = n({ x: s, ...a });
1226
1565
  Number.isFinite(p) && i.push({ x: s, y: p });
@@ -1231,27 +1570,27 @@ class Te {
1231
1570
  }
1232
1571
  /** Compute 2D parametric curve */
1233
1572
  compute2DParametric(t, r, o, a, n) {
1234
- const i = this.parser.parse(t), c = this.parser.parse(r), u = [], s = (o.max - o.min) / a;
1573
+ const i = this.parser.parse(t), l = this.parser.parse(r), g = [], s = (o.max - o.min) / a;
1235
1574
  for (let p = 0; p <= a; p++) {
1236
- const m = o.min + p * s;
1575
+ const u = o.min + p * s;
1237
1576
  try {
1238
- const y = i({ t: m, ...n }), f = c({ t: m, ...n });
1239
- Number.isFinite(y) && Number.isFinite(f) && u.push({ x: y, y: f });
1577
+ const x = i({ t: u, ...n }), f = l({ t: u, ...n });
1578
+ Number.isFinite(x) && Number.isFinite(f) && g.push({ x, y: f });
1240
1579
  } catch {
1241
1580
  }
1242
1581
  }
1243
- return u;
1582
+ return g;
1244
1583
  }
1245
1584
  /** Compute 2D polar curve */
1246
1585
  compute2DPolar(t, r, o, a) {
1247
- const n = this.parser.parse(t), i = [], c = (r.max - r.min) / o;
1248
- for (let u = 0; u <= o; u++) {
1249
- const s = r.min + u * c;
1586
+ const n = this.parser.parse(t), i = [], l = (r.max - r.min) / o;
1587
+ for (let g = 0; g <= o; g++) {
1588
+ const s = r.min + g * l;
1250
1589
  try {
1251
1590
  const p = n({ theta: s, t: s, ...a });
1252
1591
  if (Number.isFinite(p)) {
1253
- const m = p * Math.cos(s), y = p * Math.sin(s);
1254
- i.push({ x: m, y });
1592
+ const u = p * Math.cos(s), x = p * Math.sin(s);
1593
+ i.push({ x: u, y: x });
1255
1594
  }
1256
1595
  } catch {
1257
1596
  }
@@ -1260,52 +1599,52 @@ class Te {
1260
1599
  }
1261
1600
  /** Compute 3D surface points */
1262
1601
  compute3DSurface(t, r, o, a, n) {
1263
- const i = this.parser.parse(t), c = [], u = (r.max - r.min) / a, s = (o.max - o.min) / a;
1602
+ const i = this.parser.parse(t), l = [], g = (r.max - r.min) / a, s = (o.max - o.min) / a;
1264
1603
  for (let p = 0; p <= a; p++) {
1265
- const m = [], y = r.min + p * u;
1604
+ const u = [], x = r.min + p * g;
1266
1605
  for (let f = 0; f <= a; f++) {
1267
- const C = o.min + f * s;
1606
+ const w = o.min + f * s;
1268
1607
  try {
1269
- const x = i({ x: y, y: C, ...n });
1270
- Number.isFinite(x) ? m.push({ x: y, y: C, z: x }) : m.push({ x: y, y: C, z: 0 });
1608
+ const y = i({ x, y: w, ...n });
1609
+ Number.isFinite(y) ? u.push({ x, y: w, z: y }) : u.push({ x, y: w, z: 0 });
1271
1610
  } catch {
1272
- m.push({ x: y, y: C, z: 0 });
1611
+ u.push({ x, y: w, z: 0 });
1273
1612
  }
1274
1613
  }
1275
- c.push(m);
1614
+ l.push(u);
1276
1615
  }
1277
- return c;
1616
+ return l;
1278
1617
  }
1279
1618
  /** Export plot data as SVG */
1280
1619
  exportSVG(t, r, o, a) {
1281
- const i = o - 80, c = a - 80, u = (m) => 40 + (m - r.xRange.min) / (r.xRange.max - r.xRange.min) * i, s = (m) => a - 40 - (m - r.yRange.min) / (r.yRange.max - r.yRange.min) * c, p = [
1620
+ const i = o - 80, l = a - 80, g = (u) => 40 + (u - r.xRange.min) / (r.xRange.max - r.xRange.min) * i, s = (u) => a - 40 - (u - r.yRange.min) / (r.yRange.max - r.yRange.min) * l, p = [
1282
1621
  `<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${a}">`,
1283
1622
  `<rect width="100%" height="100%" fill="rgb(${r.backgroundColor.r},${r.backgroundColor.g},${r.backgroundColor.b})"/>`
1284
1623
  ];
1285
1624
  if (r.showGrid) {
1286
1625
  p.push('<g stroke="var(--nice-border, #ddd)" stroke-width="0.5">');
1287
- for (let m = Math.ceil(r.xRange.min); m <= r.xRange.max; m++) {
1288
- const y = u(m);
1289
- p.push(`<line x1="${y}" y1="40" x2="${y}" y2="${a - 40}"/>`);
1626
+ for (let u = Math.ceil(r.xRange.min); u <= r.xRange.max; u++) {
1627
+ const x = g(u);
1628
+ p.push(`<line x1="${x}" y1="40" x2="${x}" y2="${a - 40}"/>`);
1290
1629
  }
1291
- for (let m = Math.ceil(r.yRange.min); m <= r.yRange.max; m++) {
1292
- const y = s(m);
1293
- p.push(`<line x1="40" y1="${y}" x2="${o - 40}" y2="${y}"/>`);
1630
+ for (let u = Math.ceil(r.yRange.min); u <= r.yRange.max; u++) {
1631
+ const x = s(u);
1632
+ p.push(`<line x1="40" y1="${x}" x2="${o - 40}" y2="${x}"/>`);
1294
1633
  }
1295
1634
  p.push("</g>");
1296
1635
  }
1297
1636
  if (r.showAxes) {
1298
1637
  p.push('<g stroke="var(--nice-text, #333)" stroke-width="1">');
1299
- const m = s(0), y = u(0);
1300
- p.push(`<line x1="40" y1="${m}" x2="${o - 40}" y2="${m}"/>`), p.push(`<line x1="${y}" y1="40" x2="${y}" y2="${a - 40}"/>`), p.push("</g>");
1638
+ const u = s(0), x = g(0);
1639
+ p.push(`<line x1="40" y1="${u}" x2="${o - 40}" y2="${u}"/>`), p.push(`<line x1="${x}" y1="40" x2="${x}" y2="${a - 40}"/>`), p.push("</g>");
1301
1640
  }
1302
- for (const m of t.filter((y) => y.visible))
1303
- if (m.type === "2d-function") {
1304
- const y = this.compute2DFunction(m.expression, r.xRange, m.resolution || 200);
1305
- if (y.length > 0) {
1306
- const f = y.map((C, x) => `${x === 0 ? "M" : "L"}${u(C.x)},${s(C.y)}`).join(" ");
1641
+ for (const u of t.filter((x) => x.visible))
1642
+ if (u.type === "2d-function") {
1643
+ const x = this.compute2DFunction(u.expression, r.xRange, u.resolution || 200);
1644
+ if (x.length > 0) {
1645
+ const f = x.map((w, y) => `${y === 0 ? "M" : "L"}${g(w.x)},${s(w.y)}`).join(" ");
1307
1646
  p.push(
1308
- `<path d="${f}" fill="none" stroke="rgb(${m.color.r},${m.color.g},${m.color.b})" stroke-width="${m.lineWidth}"/>`
1647
+ `<path d="${f}" fill="none" stroke="rgb(${u.color.r},${u.color.g},${u.color.b})" stroke-width="${u.lineWidth}"/>`
1309
1648
  );
1310
1649
  }
1311
1650
  }
@@ -1319,26 +1658,26 @@ class Te {
1319
1658
  /** Export as PNG (data URL) */
1320
1659
  async exportPNG(t, r, o, a) {
1321
1660
  const n = this.exportSVG(t, r, o, a);
1322
- return new Promise((i, c) => {
1323
- const u = new Image();
1324
- u.onload = () => {
1661
+ return new Promise((i, l) => {
1662
+ const g = new Image();
1663
+ g.onload = () => {
1325
1664
  const s = document.createElement("canvas");
1326
1665
  s.width = o, s.height = a;
1327
1666
  const p = s.getContext("2d");
1328
1667
  if (!p) {
1329
- c(new Error("Could not get canvas context"));
1668
+ l(new Error("Could not get canvas context"));
1330
1669
  return;
1331
1670
  }
1332
- p.drawImage(u, 0, 0), i(s.toDataURL("image/png"));
1333
- }, u.onerror = c, u.src = "data:image/svg+xml;base64," + btoa(n);
1671
+ p.drawImage(g, 0, 0), i(s.toDataURL("image/png"));
1672
+ }, g.onerror = l, g.src = "data:image/svg+xml;base64," + btoa(n);
1334
1673
  });
1335
1674
  }
1336
1675
  generateId() {
1337
1676
  return Date.now().toString(36) + Math.random().toString(36).substring(2, 8);
1338
1677
  }
1339
1678
  }
1340
- function tt(e) {
1341
- return new Te(e);
1679
+ function at(e) {
1680
+ return new Ie(e);
1342
1681
  }
1343
1682
  const ee = [
1344
1683
  // Basic
@@ -1423,14 +1762,14 @@ const ee = [
1423
1762
  type: "3d-surface",
1424
1763
  category: "3d"
1425
1764
  }
1426
- ], se = /* @__PURE__ */ F(null);
1427
- function Y() {
1428
- const e = j(se);
1765
+ ], ce = /* @__PURE__ */ O(null);
1766
+ function K() {
1767
+ const e = F(ce);
1429
1768
  if (!e)
1430
1769
  throw new Error("useGraph must be used within GraphProvider");
1431
1770
  return e;
1432
1771
  }
1433
- const $ = {
1772
+ const T = {
1434
1773
  container: {
1435
1774
  display: "flex",
1436
1775
  height: "100%",
@@ -1489,14 +1828,14 @@ const $ = {
1489
1828
  backgroundColor: "var(--nice-bg-secondary, #fafafa)"
1490
1829
  }
1491
1830
  };
1492
- function rt({
1831
+ function nt({
1493
1832
  service: e,
1494
1833
  width: t = 800,
1495
1834
  height: r = 600,
1496
1835
  className: o,
1497
1836
  style: a
1498
1837
  }) {
1499
- const [n, i] = P([]), [c, u] = P({
1838
+ const [n, i] = M([]), [l, g] = M({
1500
1839
  xRange: { min: -10, max: 10 },
1501
1840
  yRange: { min: -10, max: 10 },
1502
1841
  zRange: { min: -5, max: 5 },
@@ -1507,59 +1846,59 @@ function rt({
1507
1846
  cameraRotationX: 30,
1508
1847
  cameraRotationY: 45,
1509
1848
  cameraDistance: 5
1510
- }), [s, p] = P({
1849
+ }), [s, p] = M({
1511
1850
  isPlaying: !1,
1512
1851
  parameter: "a",
1513
1852
  currentValue: 0,
1514
1853
  minValue: -5,
1515
1854
  maxValue: 5,
1516
1855
  speed: 1
1517
- }), m = R(() => {
1856
+ }), u = R(() => {
1518
1857
  i(e.getPlots());
1519
- }, [e]), y = R((g) => {
1520
- u((w) => ({ ...w, ...g }));
1521
- }, []), f = R((g) => {
1522
- p((w) => ({ ...w, ...g }));
1523
- }, []), C = R(
1524
- (g) => {
1525
- e.addPlot(g), m();
1858
+ }, [e]), x = R((m) => {
1859
+ g((k) => ({ ...k, ...m }));
1860
+ }, []), f = R((m) => {
1861
+ p((k) => ({ ...k, ...m }));
1862
+ }, []), w = R(
1863
+ (m) => {
1864
+ e.addPlot(m), u();
1526
1865
  },
1527
- [e, m]
1528
- ), x = R(
1529
- (g) => {
1530
- e.removePlot(g), m();
1866
+ [e, u]
1867
+ ), y = R(
1868
+ (m) => {
1869
+ e.removePlot(m), u();
1531
1870
  },
1532
- [e, m]
1871
+ [e, u]
1533
1872
  ), b = R(
1534
- (g, w) => {
1535
- e.updatePlot(g, w), m();
1873
+ (m, k) => {
1874
+ e.updatePlot(m, k), u();
1536
1875
  },
1537
- [e, m]
1538
- ), l = {
1876
+ [e, u]
1877
+ ), c = {
1539
1878
  service: e,
1540
1879
  plots: n,
1541
- view: c,
1542
- setView: y,
1543
- addPlot: C,
1544
- removePlot: x,
1880
+ view: l,
1881
+ setView: x,
1882
+ addPlot: w,
1883
+ removePlot: y,
1545
1884
  updatePlot: b,
1546
1885
  animation: s,
1547
1886
  setAnimation: f,
1548
- refresh: m
1887
+ refresh: u
1549
1888
  };
1550
- return /* @__PURE__ */ d(se.Provider, { value: l, children: /* @__PURE__ */ v("div", { className: o, style: { ...$.container, ...a }, children: [
1551
- /* @__PURE__ */ v("div", { style: $.sidebar, children: [
1552
- /* @__PURE__ */ d(Ae, {}),
1553
- /* @__PURE__ */ d(ze, {})
1889
+ return /* @__PURE__ */ d(ce.Provider, { value: c, children: /* @__PURE__ */ v("div", { className: o, style: { ...T.container, ...a }, children: [
1890
+ /* @__PURE__ */ v("div", { style: T.sidebar, children: [
1891
+ /* @__PURE__ */ d(Ee, {}),
1892
+ /* @__PURE__ */ d(De, {})
1554
1893
  ] }),
1555
- /* @__PURE__ */ v("div", { style: $.main, children: [
1556
- /* @__PURE__ */ d(Ee, { width: t, height: r }),
1557
- /* @__PURE__ */ d(Ie, { width: t, height: r })
1894
+ /* @__PURE__ */ v("div", { style: T.main, children: [
1895
+ /* @__PURE__ */ d(Le, { width: t, height: r }),
1896
+ /* @__PURE__ */ d(qe, { width: t, height: r })
1558
1897
  ] })
1559
1898
  ] }) });
1560
1899
  }
1561
- function Ae() {
1562
- const { t: e } = L(), { addPlot: t } = Y(), [r, o] = P("sin(x)"), [a, n] = P("2d-function"), [i, c] = P("cos(x)"), u = () => {
1900
+ function Ee() {
1901
+ const { t: e } = E(), { addPlot: t } = K(), [r, o] = M("sin(x)"), [a, n] = M("2d-function"), [i, l] = M("cos(x)"), g = () => {
1563
1902
  t({
1564
1903
  type: a,
1565
1904
  expression: r,
@@ -1577,12 +1916,12 @@ function Ae() {
1577
1916
  {
1578
1917
  value: a,
1579
1918
  onChange: (s) => n(s.target.value),
1580
- style: { ...$.input, width: "100%" },
1919
+ style: { ...T.input, width: "100%" },
1581
1920
  children: [
1582
1921
  /* @__PURE__ */ d("option", { value: "2d-function", children: "y = f(x)" }),
1583
- /* @__PURE__ */ d("option", { value: "2d-parametric", children: "Parametric (x(t), y(t))" }),
1584
- /* @__PURE__ */ d("option", { value: "2d-polar", children: "Polar r = f(θ)" }),
1585
- /* @__PURE__ */ d("option", { value: "3d-surface", children: "3D Surface z = f(x,y)" })
1922
+ /* @__PURE__ */ d("option", { value: "2d-parametric", children: e("plotter.parametricXTYT", "Parametric (x(t), y(t))") }),
1923
+ /* @__PURE__ */ d("option", { value: "2d-polar", children: e("plotter.polarRF", "Polar r = f(θ)") }),
1924
+ /* @__PURE__ */ d("option", { value: "3d-surface", children: e("plotter.n3dSurfaceZFX", "3D Surface z = f(x,y)") })
1586
1925
  ]
1587
1926
  }
1588
1927
  ) }),
@@ -1592,8 +1931,8 @@ function Ae() {
1592
1931
  type: "text",
1593
1932
  value: r,
1594
1933
  onChange: (s) => o(s.target.value),
1595
- placeholder: a === "2d-parametric" ? "x(t) = ..." : "Expression...",
1596
- style: { ...$.input, width: "100%" }
1934
+ placeholder: a === "2d-parametric" ? "x(t) = ..." : e("plotter.expression", "Expression..."),
1935
+ style: { ...T.input, width: "100%" }
1597
1936
  }
1598
1937
  ) }),
1599
1938
  a === "2d-parametric" && /* @__PURE__ */ d("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ d(
@@ -1601,17 +1940,17 @@ function Ae() {
1601
1940
  {
1602
1941
  type: "text",
1603
1942
  value: i,
1604
- onChange: (s) => c(s.target.value),
1943
+ onChange: (s) => l(s.target.value),
1605
1944
  placeholder: "y(t) = ...",
1606
- style: { ...$.input, width: "100%" }
1945
+ style: { ...T.input, width: "100%" }
1607
1946
  }
1608
1947
  ) }),
1609
- /* @__PURE__ */ d("button", { onClick: u, style: { ...$.button, width: "100%" }, children: "+ Add Plot" }),
1948
+ /* @__PURE__ */ d("button", { onClick: g, style: { ...T.button, width: "100%" }, children: e("plotter.addPlot", "+ Add Plot") }),
1610
1949
  /* @__PURE__ */ v(
1611
1950
  "select",
1612
1951
  {
1613
1952
  onChange: (s) => {
1614
- const p = ee.find((m) => m.name === s.target.value);
1953
+ const p = ee.find((u) => u.name === s.target.value);
1615
1954
  p && t({
1616
1955
  type: p.type,
1617
1956
  expression: p.expression,
@@ -1624,7 +1963,7 @@ function Ae() {
1624
1963
  }
1625
1964
  });
1626
1965
  },
1627
- style: { ...$.input, width: "100%", marginTop: "8px" },
1966
+ style: { ...T.input, width: "100%", marginTop: "8px" },
1628
1967
  value: "",
1629
1968
  children: [
1630
1969
  /* @__PURE__ */ d("option", { value: "", disabled: !0, children: e("plotter.quickAdd", "Quick add preset...") }),
@@ -1638,9 +1977,9 @@ function Ae() {
1638
1977
  )
1639
1978
  ] });
1640
1979
  }
1641
- function ze() {
1642
- const { t: e } = L(), { plots: t, removePlot: r, updatePlot: o } = Y();
1643
- return /* @__PURE__ */ v("div", { style: $.plotList, children: [
1980
+ function De() {
1981
+ const { t: e } = E(), { plots: t, removePlot: r, updatePlot: o } = K();
1982
+ return /* @__PURE__ */ v("div", { style: T.plotList, children: [
1644
1983
  t.length === 0 && /* @__PURE__ */ d(
1645
1984
  "div",
1646
1985
  {
@@ -1652,7 +1991,7 @@ function ze() {
1652
1991
  children: e("plotter.noPlots", "No plots added yet")
1653
1992
  }
1654
1993
  ),
1655
- t.map((a) => /* @__PURE__ */ v("div", { style: $.plotItem, children: [
1994
+ t.map((a) => /* @__PURE__ */ v("div", { style: T.plotItem, children: [
1656
1995
  /* @__PURE__ */ v("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginBottom: "8px" }, children: [
1657
1996
  /* @__PURE__ */ d(
1658
1997
  "input",
@@ -1688,7 +2027,7 @@ function ze() {
1688
2027
  cursor: "pointer",
1689
2028
  fontSize: "12px"
1690
2029
  },
1691
- children: /* @__PURE__ */ d(G, { name: "close", size: 14 })
2030
+ children: /* @__PURE__ */ d(j, { name: "close", size: 14 })
1692
2031
  }
1693
2032
  )
1694
2033
  ] }),
@@ -1712,15 +2051,15 @@ function ze() {
1712
2051
  ] }, a.id))
1713
2052
  ] });
1714
2053
  }
1715
- function Ee({ width: e, height: t }) {
1716
- const { t: r } = L(), { service: o, plots: a, view: n, setView: i } = Y(), c = () => {
1717
- const s = o.exportSVG(a, n, e, t), p = new Blob([s], { type: "image/svg+xml" }), m = URL.createObjectURL(p), y = document.createElement("a");
1718
- y.href = m, y.download = "graph.svg", y.click(), URL.revokeObjectURL(m);
1719
- }, u = async () => {
2054
+ function Le({ width: e, height: t }) {
2055
+ const { t: r } = E(), { service: o, plots: a, view: n, setView: i } = K(), l = () => {
2056
+ const s = o.exportSVG(a, n, e, t), p = new Blob([s], { type: "image/svg+xml" }), u = URL.createObjectURL(p), x = document.createElement("a");
2057
+ x.href = u, x.download = "graph.svg", x.click(), URL.revokeObjectURL(u);
2058
+ }, g = async () => {
1720
2059
  const s = await o.exportPNG(a, n, e, t), p = document.createElement("a");
1721
2060
  p.href = s, p.download = "graph.png", p.click();
1722
2061
  };
1723
- return /* @__PURE__ */ v("div", { style: $.toolbar, children: [
2062
+ return /* @__PURE__ */ v("div", { style: T.toolbar, children: [
1724
2063
  /* @__PURE__ */ v("label", { style: { fontSize: "12px" }, children: [
1725
2064
  "X: [",
1726
2065
  " ",
@@ -1730,7 +2069,7 @@ function Ee({ width: e, height: t }) {
1730
2069
  type: "number",
1731
2070
  value: n.xRange.min,
1732
2071
  onChange: (s) => i({ xRange: { ...n.xRange, min: Number(s.target.value) } }),
1733
- style: { ...$.input, width: "50px" }
2072
+ style: { ...T.input, width: "50px" }
1734
2073
  }
1735
2074
  ),
1736
2075
  ",",
@@ -1741,7 +2080,7 @@ function Ee({ width: e, height: t }) {
1741
2080
  type: "number",
1742
2081
  value: n.xRange.max,
1743
2082
  onChange: (s) => i({ xRange: { ...n.xRange, max: Number(s.target.value) } }),
1744
- style: { ...$.input, width: "50px" }
2083
+ style: { ...T.input, width: "50px" }
1745
2084
  }
1746
2085
  ),
1747
2086
  "]"
@@ -1755,7 +2094,7 @@ function Ee({ width: e, height: t }) {
1755
2094
  type: "number",
1756
2095
  value: n.yRange.min,
1757
2096
  onChange: (s) => i({ yRange: { ...n.yRange, min: Number(s.target.value) } }),
1758
- style: { ...$.input, width: "50px" }
2097
+ style: { ...T.input, width: "50px" }
1759
2098
  }
1760
2099
  ),
1761
2100
  ",",
@@ -1766,7 +2105,7 @@ function Ee({ width: e, height: t }) {
1766
2105
  type: "number",
1767
2106
  value: n.yRange.max,
1768
2107
  onChange: (s) => i({ yRange: { ...n.yRange, max: Number(s.target.value) } }),
1769
- style: { ...$.input, width: "50px" }
2108
+ style: { ...T.input, width: "50px" }
1770
2109
  }
1771
2110
  ),
1772
2111
  "]"
@@ -1797,10 +2136,10 @@ function Ee({ width: e, height: t }) {
1797
2136
  /* @__PURE__ */ v(
1798
2137
  "button",
1799
2138
  {
1800
- onClick: c,
1801
- style: { ...$.button, backgroundColor: "var(--nice-success, #4caf50)" },
2139
+ onClick: l,
2140
+ style: { ...T.button, backgroundColor: "var(--nice-success, #4caf50)" },
1802
2141
  children: [
1803
- /* @__PURE__ */ d(G, { name: "download", size: 14 }),
2142
+ /* @__PURE__ */ d(j, { name: "download", size: 14 }),
1804
2143
  " SVG"
1805
2144
  ]
1806
2145
  }
@@ -1808,97 +2147,97 @@ function Ee({ width: e, height: t }) {
1808
2147
  /* @__PURE__ */ v(
1809
2148
  "button",
1810
2149
  {
1811
- onClick: u,
1812
- style: { ...$.button, backgroundColor: "var(--nice-warning, #ff9800)" },
2150
+ onClick: g,
2151
+ style: { ...T.button, backgroundColor: "var(--nice-warning, #ff9800)" },
1813
2152
  children: [
1814
- /* @__PURE__ */ d(G, { name: "download", size: 14 }),
2153
+ /* @__PURE__ */ d(j, { name: "download", size: 14 }),
1815
2154
  " PNG"
1816
2155
  ]
1817
2156
  }
1818
2157
  )
1819
2158
  ] });
1820
2159
  }
1821
- function Ie({ width: e, height: t }) {
1822
- const r = U(null), { service: o, plots: a, view: n, animation: i } = Y(), c = 40;
1823
- return V(() => {
1824
- const u = r.current, s = u == null ? void 0 : u.getContext("2d");
1825
- if (!u || !s)
2160
+ function qe({ width: e, height: t }) {
2161
+ const r = U(null), { service: o, plots: a, view: n, animation: i } = K(), l = 40;
2162
+ return Y(() => {
2163
+ const g = r.current, s = g == null ? void 0 : g.getContext("2d");
2164
+ if (!g || !s)
1826
2165
  return;
1827
2166
  s.fillStyle = `rgb(${n.backgroundColor.r},${n.backgroundColor.g},${n.backgroundColor.b})`, s.fillRect(0, 0, e, t);
1828
- const p = e - c * 2, m = t - c * 2, y = (x) => c + (x - n.xRange.min) / (n.xRange.max - n.xRange.min) * p, f = (x) => t - c - (x - n.yRange.min) / (n.yRange.max - n.yRange.min) * m;
2167
+ const p = e - l * 2, u = t - l * 2, x = (y) => l + (y - n.xRange.min) / (n.xRange.max - n.xRange.min) * p, f = (y) => t - l - (y - n.yRange.min) / (n.yRange.max - n.yRange.min) * u;
1829
2168
  if (n.showGrid) {
1830
- s.strokeStyle = I("var(--nice-border, #e0e0e0)", s.canvas), s.lineWidth = 0.5;
1831
- for (let x = Math.ceil(n.xRange.min); x <= n.xRange.max; x++) {
1832
- const b = y(x);
1833
- s.beginPath(), s.moveTo(b, c), s.lineTo(b, t - c), s.stroke();
2169
+ s.strokeStyle = D("var(--nice-border, #e0e0e0)", s.canvas), s.lineWidth = 0.5;
2170
+ for (let y = Math.ceil(n.xRange.min); y <= n.xRange.max; y++) {
2171
+ const b = x(y);
2172
+ s.beginPath(), s.moveTo(b, l), s.lineTo(b, t - l), s.stroke();
1834
2173
  }
1835
- for (let x = Math.ceil(n.yRange.min); x <= n.yRange.max; x++) {
1836
- const b = f(x);
1837
- s.beginPath(), s.moveTo(c, b), s.lineTo(e - c, b), s.stroke();
2174
+ for (let y = Math.ceil(n.yRange.min); y <= n.yRange.max; y++) {
2175
+ const b = f(y);
2176
+ s.beginPath(), s.moveTo(l, b), s.lineTo(e - l, b), s.stroke();
1838
2177
  }
1839
2178
  }
1840
2179
  if (n.showAxes) {
1841
- s.strokeStyle = I("var(--nice-text, #333)", s.canvas), s.lineWidth = 1;
1842
- const x = f(0);
1843
- s.beginPath(), s.moveTo(c, x), s.lineTo(e - c, x), s.stroke();
1844
- const b = y(0);
1845
- if (s.beginPath(), s.moveTo(b, c), s.lineTo(b, t - c), s.stroke(), n.showLabels) {
1846
- s.fillStyle = I("var(--nice-text, #333)", s.canvas), s.font = "12px sans-serif", s.textAlign = "center", s.fillText("x", e - c + 15, x + 4), s.fillText("y", b, c - 10), s.font = "10px sans-serif";
1847
- for (let l = Math.ceil(n.xRange.min); l <= n.xRange.max; l++)
1848
- l !== 0 && s.fillText(String(l), y(l), x + 15);
1849
- for (let l = Math.ceil(n.yRange.min); l <= n.yRange.max; l++)
1850
- l !== 0 && (s.textAlign = "right", s.fillText(String(l), b - 5, f(l) + 4));
2180
+ s.strokeStyle = D("var(--nice-text, #333)", s.canvas), s.lineWidth = 1;
2181
+ const y = f(0);
2182
+ s.beginPath(), s.moveTo(l, y), s.lineTo(e - l, y), s.stroke();
2183
+ const b = x(0);
2184
+ if (s.beginPath(), s.moveTo(b, l), s.lineTo(b, t - l), s.stroke(), n.showLabels) {
2185
+ s.fillStyle = D("var(--nice-text, #333)", s.canvas), s.font = "12px sans-serif", s.textAlign = "center", s.fillText("x", e - l + 15, y + 4), s.fillText("y", b, l - 10), s.font = "10px sans-serif";
2186
+ for (let c = Math.ceil(n.xRange.min); c <= n.xRange.max; c++)
2187
+ c !== 0 && s.fillText(String(c), x(c), y + 15);
2188
+ for (let c = Math.ceil(n.yRange.min); c <= n.yRange.max; c++)
2189
+ c !== 0 && (s.textAlign = "right", s.fillText(String(c), b - 5, f(c) + 4));
1851
2190
  }
1852
2191
  }
1853
- const C = i.isPlaying ? { [i.parameter]: i.currentValue } : {};
1854
- for (const x of a.filter((b) => b.visible)) {
1855
- const b = `rgb(${x.color.r},${x.color.g},${x.color.b})`;
1856
- s.strokeStyle = b, s.lineWidth = x.lineWidth || 2;
1857
- let l = [];
1858
- switch (x.type) {
2192
+ const w = i.isPlaying ? { [i.parameter]: i.currentValue } : {};
2193
+ for (const y of a.filter((b) => b.visible)) {
2194
+ const b = `rgb(${y.color.r},${y.color.g},${y.color.b})`;
2195
+ s.strokeStyle = b, s.lineWidth = y.lineWidth || 2;
2196
+ let c = [];
2197
+ switch (y.type) {
1859
2198
  case "2d-function":
1860
- l = o.compute2DFunction(
1861
- x.expression,
2199
+ c = o.compute2DFunction(
2200
+ y.expression,
1862
2201
  n.xRange,
1863
- x.resolution || 200,
1864
- C
2202
+ y.resolution || 200,
2203
+ w
1865
2204
  );
1866
2205
  break;
1867
2206
  case "2d-parametric":
1868
- l = o.compute2DParametric(
1869
- x.expression,
1870
- x.expressionY || "sin(t)",
1871
- x.parameterRange || { min: 0, max: 2 * Math.PI },
1872
- x.resolution || 200,
1873
- C
2207
+ c = o.compute2DParametric(
2208
+ y.expression,
2209
+ y.expressionY || "sin(t)",
2210
+ y.parameterRange || { min: 0, max: 2 * Math.PI },
2211
+ y.resolution || 200,
2212
+ w
1874
2213
  );
1875
2214
  break;
1876
2215
  case "2d-polar":
1877
- l = o.compute2DPolar(
1878
- x.expression,
1879
- x.parameterRange || { min: 0, max: 2 * Math.PI },
1880
- x.resolution || 200,
1881
- C
2216
+ c = o.compute2DPolar(
2217
+ y.expression,
2218
+ y.parameterRange || { min: 0, max: 2 * Math.PI },
2219
+ y.resolution || 200,
2220
+ w
1882
2221
  );
1883
2222
  break;
1884
2223
  }
1885
- if (l.length > 0) {
2224
+ if (c.length > 0) {
1886
2225
  s.beginPath();
1887
- let g = !1;
1888
- for (const w of l) {
1889
- const M = y(w.x), h = f(w.y);
2226
+ let m = !1;
2227
+ for (const k of c) {
2228
+ const C = x(k.x), h = f(k.y);
1890
2229
  if (h < 0 || h > t) {
1891
- g = !1;
2230
+ m = !1;
1892
2231
  continue;
1893
2232
  }
1894
- g ? s.lineTo(M, h) : (s.moveTo(M, h), g = !0);
2233
+ m ? s.lineTo(C, h) : (s.moveTo(C, h), m = !0);
1895
2234
  }
1896
2235
  s.stroke();
1897
2236
  }
1898
2237
  }
1899
- }, [a, n, i, o, e, t]), /* @__PURE__ */ d("canvas", { ref: r, width: e, height: t, style: $.canvas });
2238
+ }, [a, n, i, o, e, t]), /* @__PURE__ */ d("canvas", { ref: r, width: e, height: t, style: T.canvas });
1900
2239
  }
1901
- const O = [
2240
+ const G = [
1902
2241
  // Length
1903
2242
  { name: "Meter", symbol: "m", category: "Length", toBase: (e) => e, fromBase: (e) => e },
1904
2243
  {
@@ -2168,7 +2507,7 @@ const O = [
2168
2507
  fromBase: (e) => e / 1099511627776
2169
2508
  },
2170
2509
  { name: "Bit", symbol: "bit", category: "Data", toBase: (e) => e / 8, fromBase: (e) => e * 8 }
2171
- ], z = {
2510
+ ], $ = {
2172
2511
  create(e, t, r = 0) {
2173
2512
  const o = [];
2174
2513
  for (let a = 0; a < e; a++)
@@ -2245,8 +2584,8 @@ const O = [
2245
2584
  if (n === t)
2246
2585
  continue;
2247
2586
  let i = 0;
2248
- for (let c = 0; c < e.cols; c++)
2249
- c !== r && (o.data[a][i] = e.data[n][c], i++);
2587
+ for (let l = 0; l < e.cols; l++)
2588
+ l !== r && (o.data[a][i] = e.data[n][l], i++);
2250
2589
  a++;
2251
2590
  }
2252
2591
  return o;
@@ -2258,8 +2597,8 @@ const O = [
2258
2597
  const r = e.rows, o = this.create(r, r);
2259
2598
  for (let a = 0; a < r; a++)
2260
2599
  for (let n = 0; n < r; n++) {
2261
- const i = Math.pow(-1, a + n), c = this.determinant(this.minor(e, a, n));
2262
- o.data[n][a] = i * c;
2600
+ const i = Math.pow(-1, a + n), l = this.determinant(this.minor(e, a, n));
2601
+ o.data[n][a] = i * l;
2263
2602
  }
2264
2603
  return this.scalar(o, 1 / t);
2265
2604
  },
@@ -2274,11 +2613,11 @@ const O = [
2274
2613
  eigenvalues2x2(e) {
2275
2614
  if (e.rows !== 2 || e.cols !== 2)
2276
2615
  throw new Error("Only 2x2 matrices supported for eigenvalues");
2277
- const t = e.data[0][0], r = e.data[0][1], o = e.data[1][0], a = e.data[1][1], n = t + a, i = t * a - r * o, c = n * n - 4 * i;
2278
- if (c < 0)
2616
+ const t = e.data[0][0], r = e.data[0][1], o = e.data[1][0], a = e.data[1][1], n = t + a, i = t * a - r * o, l = n * n - 4 * i;
2617
+ if (l < 0)
2279
2618
  throw new Error("Complex eigenvalues not supported");
2280
- const u = Math.sqrt(c);
2281
- return [(n + u) / 2, (n - u) / 2];
2619
+ const g = Math.sqrt(l);
2620
+ return [(n + g) / 2, (n - g) / 2];
2282
2621
  },
2283
2622
  toString(e, t = 4) {
2284
2623
  return e.data.map((r) => "[ " + r.map((o) => o.toFixed(t).padStart(10)).join(" ") + " ]").join(`
@@ -2299,8 +2638,8 @@ const O = [
2299
2638
  const a = (r - t) / o;
2300
2639
  let n = e(t) + e(r);
2301
2640
  for (let i = 1; i < o; i++) {
2302
- const c = t + i * a;
2303
- n += i % 2 === 0 ? 2 * e(c) : 4 * e(c);
2641
+ const l = t + i * a;
2642
+ n += i % 2 === 0 ? 2 * e(l) : 4 * e(l);
2304
2643
  }
2305
2644
  return a / 3 * n;
2306
2645
  },
@@ -2311,10 +2650,10 @@ const O = [
2311
2650
  const i = e(a);
2312
2651
  if (Math.abs(i) < r)
2313
2652
  return a;
2314
- const c = this.derivative(e, a);
2315
- if (c === 0)
2653
+ const l = this.derivative(e, a);
2654
+ if (l === 0)
2316
2655
  throw new Error("Derivative is zero, Newton-Raphson failed");
2317
- a = a - i / c;
2656
+ a = a - i / l;
2318
2657
  }
2319
2658
  throw new Error("Newton-Raphson did not converge");
2320
2659
  },
@@ -2360,12 +2699,12 @@ const O = [
2360
2699
  return [(-t + a) / (2 * e), (-t - a) / (2 * e)];
2361
2700
  }
2362
2701
  };
2363
- class Le {
2702
+ class Xe {
2364
2703
  constructor(t = {}) {
2365
- T(this, "history", []);
2366
- T(this, "memory", 0);
2367
- T(this, "variables", /* @__PURE__ */ new Map());
2368
- T(this, "config");
2704
+ z(this, "history", []);
2705
+ z(this, "memory", 0);
2706
+ z(this, "variables", /* @__PURE__ */ new Map());
2707
+ z(this, "config");
2369
2708
  this.config = {
2370
2709
  precision: t.precision ?? 12,
2371
2710
  angleUnit: t.angleUnit ?? "rad"
@@ -2378,24 +2717,24 @@ class Le {
2378
2717
  * `log` is base 10 like the key, `ln` natural; trig functions follow `angleUnit`.
2379
2718
  */
2380
2719
  evaluate(t) {
2381
- const r = this.config.angleUnit === "deg", o = (c) => r ? c * Math.PI / 180 : c, a = (c) => r ? c * 180 / Math.PI : c, n = new ie({
2720
+ const r = this.config.angleUnit === "deg", o = (l) => r ? l * Math.PI / 180 : l, a = (l) => r ? l * 180 / Math.PI : l, n = new le({
2382
2721
  strict: !0,
2383
2722
  ignoreCase: !0,
2384
2723
  functions: {
2385
2724
  log: Math.log10,
2386
- sin: (c) => Math.sin(o(c)),
2387
- cos: (c) => Math.cos(o(c)),
2388
- tan: (c) => Math.tan(o(c)),
2389
- asin: (c) => a(Math.asin(c)),
2390
- acos: (c) => a(Math.acos(c)),
2391
- atan: (c) => a(Math.atan(c))
2725
+ sin: (l) => Math.sin(o(l)),
2726
+ cos: (l) => Math.cos(o(l)),
2727
+ tan: (l) => Math.tan(o(l)),
2728
+ asin: (l) => a(Math.asin(l)),
2729
+ acos: (l) => a(Math.acos(l)),
2730
+ atan: (l) => a(Math.atan(l))
2392
2731
  }
2393
2732
  });
2394
2733
  let i;
2395
2734
  try {
2396
2735
  i = n.parse(t)(Object.fromEntries(this.variables));
2397
- } catch (c) {
2398
- throw new Error(`Invalid expression: ${c.message}`);
2736
+ } catch (l) {
2737
+ throw new Error(`Invalid expression: ${l.message}`);
2399
2738
  }
2400
2739
  if (!Number.isFinite(i))
2401
2740
  throw new Error("Invalid expression: Invalid result");
@@ -2448,7 +2787,7 @@ class Le {
2448
2787
  }
2449
2788
  /** Convert units */
2450
2789
  convertUnits(t, r, o) {
2451
- const a = O.find((c) => c.symbol === r), n = O.find((c) => c.symbol === o);
2790
+ const a = G.find((l) => l.symbol === r), n = G.find((l) => l.symbol === o);
2452
2791
  if (!a || !n)
2453
2792
  throw new Error("Unknown unit");
2454
2793
  if (a.category !== n.category)
@@ -2458,11 +2797,11 @@ class Le {
2458
2797
  }
2459
2798
  /** Get units by category */
2460
2799
  getUnitsByCategory(t) {
2461
- return O.filter((r) => r.category === t);
2800
+ return G.filter((r) => r.category === t);
2462
2801
  }
2463
2802
  /** Get all unit categories */
2464
2803
  getUnitCategories() {
2465
- return [...new Set(O.map((t) => t.category))];
2804
+ return [...new Set(G.map((t) => t.category))];
2466
2805
  }
2467
2806
  /** Format number with precision */
2468
2807
  format(t) {
@@ -2470,12 +2809,12 @@ class Le {
2470
2809
  return Math.abs(t) < 1e-10 ? "0" : Math.abs(t) > 1e10 || Math.abs(t) < 1e-6 ? t.toExponential(r) : parseFloat(t.toPrecision(r)).toString();
2471
2810
  }
2472
2811
  }
2473
- function ot(e) {
2474
- return new Le(e);
2812
+ function it(e) {
2813
+ return new Xe(e);
2475
2814
  }
2476
- const ce = /* @__PURE__ */ F(null);
2477
- function N() {
2478
- const e = j(ce);
2815
+ const de = /* @__PURE__ */ O(null);
2816
+ function X() {
2817
+ const e = F(de);
2479
2818
  if (!e)
2480
2819
  throw new Error("useCalculator must be used within CalculatorProvider");
2481
2820
  return e;
@@ -2538,76 +2877,77 @@ const B = {
2538
2877
  backgroundColor: "var(--nice-bg-tertiary, #505050)"
2539
2878
  }
2540
2879
  };
2541
- function at({
2880
+ function st({
2542
2881
  service: e,
2543
2882
  className: t,
2544
2883
  style: r
2545
2884
  }) {
2546
- const [o, a] = P("0"), [n, i] = P("standard"), [c, u] = P([]), [s, p] = P(!1), m = R(
2547
- (x) => {
2548
- s && /[0-9.]/.test(x) ? (a(x), p(!1)) : (a((b) => b === "0" && x !== "." ? x : b + x), p(!1));
2885
+ const [o, a] = M("0"), [n, i] = M("standard"), [l, g] = M([]), [s, p] = M(!1), u = R(
2886
+ (y) => {
2887
+ s && /[0-9.]/.test(y) ? (a(y), p(!1)) : (a((b) => b === "0" && y !== "." ? y : b + y), p(!1));
2549
2888
  },
2550
2889
  [s]
2551
- ), y = R(() => {
2890
+ ), x = R(() => {
2552
2891
  a("0"), p(!1);
2553
2892
  }, []), f = R(() => {
2554
2893
  try {
2555
- const x = e.evaluate(o), b = e.format(x);
2556
- e.addHistory(o, b, n), u(e.getHistory()), a(b), p(!0);
2894
+ const y = e.evaluate(o), b = e.format(y);
2895
+ e.addHistory(o, b, n), g(e.getHistory()), a(b), p(!0);
2557
2896
  } catch {
2558
2897
  a("Error"), p(!0);
2559
2898
  }
2560
- }, [o, n, e]), C = {
2899
+ }, [o, n, e]), w = {
2561
2900
  service: e,
2562
2901
  display: o,
2563
2902
  setDisplay: a,
2564
2903
  mode: n,
2565
2904
  setMode: i,
2566
- history: c,
2905
+ history: l,
2567
2906
  calculate: f,
2568
- appendDigit: m,
2569
- clear: y
2907
+ appendDigit: u,
2908
+ clear: x
2570
2909
  };
2571
- return /* @__PURE__ */ d(ce.Provider, { value: C, children: /* @__PURE__ */ v("div", { className: t, style: { ...B.container, ...r }, children: [
2572
- /* @__PURE__ */ d(De, {}),
2573
- /* @__PURE__ */ d(qe, {}),
2574
- n === "standard" && /* @__PURE__ */ d(le, {}),
2575
- n === "scientific" && /* @__PURE__ */ d(Ne, {}),
2576
- n === "programmer" && /* @__PURE__ */ d(Xe, {}),
2910
+ return /* @__PURE__ */ d(de.Provider, { value: w, children: /* @__PURE__ */ v("div", { className: t, style: { ...B.container, ...r }, children: [
2911
+ /* @__PURE__ */ d(Ne, {}),
2912
+ /* @__PURE__ */ d(je, {}),
2913
+ n === "standard" && /* @__PURE__ */ d(pe, {}),
2914
+ n === "scientific" && /* @__PURE__ */ d(Fe, {}),
2915
+ n === "programmer" && /* @__PURE__ */ d(Oe, {}),
2577
2916
  n === "matrix" && /* @__PURE__ */ d(Ge, {}),
2578
- n === "calculus" && /* @__PURE__ */ d(je, {}),
2579
- n === "units" && /* @__PURE__ */ d(Fe, {})
2917
+ n === "calculus" && /* @__PURE__ */ d(Ue, {}),
2918
+ n === "units" && /* @__PURE__ */ d(Ye, {})
2580
2919
  ] }) });
2581
2920
  }
2582
- function De() {
2583
- const { mode: e, setMode: t } = N(), r = [
2584
- { id: "standard", label: "Standard" },
2585
- { id: "scientific", label: "Scientific" },
2586
- { id: "programmer", label: "Programmer" },
2587
- { id: "matrix", label: "Matrix" },
2588
- { id: "calculus", label: "Calculus" },
2589
- { id: "units", label: "Units" }
2921
+ function Ne() {
2922
+ const { t: e } = E(), { mode: t, setMode: r } = X(), o = [
2923
+ { id: "standard", label: e("calculator.standard", "Standard") },
2924
+ { id: "scientific", label: e("calculator.scientific", "Scientific") },
2925
+ { id: "programmer", label: e("calculator.programmer", "Programmer") },
2926
+ { id: "matrix", label: e("calculator.matrix", "Matrix") },
2927
+ { id: "calculus", label: e("calculator.calculus", "Calculus") },
2928
+ { id: "units", label: e("calculator.units", "Units") }
2590
2929
  ];
2591
- return /* @__PURE__ */ d("div", { style: B.modeSelector, children: r.map((o) => /* @__PURE__ */ d(
2930
+ return /* @__PURE__ */ d("div", { style: B.modeSelector, children: o.map((a) => /* @__PURE__ */ d(
2592
2931
  "button",
2593
2932
  {
2594
- onClick: () => t(o.id),
2933
+ onClick: () => r(a.id),
2595
2934
  style: {
2596
2935
  ...B.modeButton,
2597
- backgroundColor: e === o.id ? "var(--nice-primary-hover, #1976d2)" : "transparent",
2598
- color: e === o.id ? "var(--nice-color-white, #fff)" : "var(--nice-text-secondary, #888)"
2936
+ backgroundColor: t === a.id ? "var(--nice-primary-hover, #1976d2)" : "transparent",
2937
+ color: t === a.id ? "var(--nice-color-white, #fff)" : "var(--nice-text-secondary, #888)"
2599
2938
  },
2600
- children: o.label
2939
+ children: a.label
2601
2940
  },
2602
- o.id
2941
+ a.id
2603
2942
  )) });
2604
2943
  }
2605
- function qe() {
2606
- const { display: e } = N();
2944
+ function je() {
2945
+ const { display: e } = X();
2607
2946
  return /* @__PURE__ */ d("div", { style: B.display, children: /* @__PURE__ */ d("div", { style: B.displayText, children: e }) });
2608
2947
  }
2609
- function le() {
2610
- const { appendDigit: e, clear: t, calculate: r, setDisplay: o, display: a } = N(), n = [
2948
+ function pe() {
2949
+ const { appendDigit: e, clear: t, calculate: r, setDisplay: o, display: a } = X(), n = [
2950
+ // audit-allow: i18n — the calculator key, the same in every language
2611
2951
  { label: "AC", action: t, style: B.keyFunction },
2612
2952
  {
2613
2953
  label: "±",
@@ -2633,16 +2973,16 @@ function le() {
2633
2973
  { label: "⌫", action: () => o(a.length > 1 ? a.slice(0, -1) : "0") },
2634
2974
  { label: "=", action: r, style: B.keyOperator }
2635
2975
  ];
2636
- return /* @__PURE__ */ d("div", { style: B.keypad, children: n.map((i, c) => /* @__PURE__ */ d("button", { onClick: i.action, style: { ...B.key, ...i.style || {} }, children: i.label }, c)) });
2976
+ return /* @__PURE__ */ d("div", { style: B.keypad, children: n.map((i, l) => /* @__PURE__ */ d("button", { onClick: i.action, style: { ...B.key, ...i.style || {} }, children: i.label }, l)) });
2637
2977
  }
2638
- function Ne() {
2978
+ function Fe() {
2639
2979
  const {
2640
2980
  appendDigit: e,
2641
2981
  clear: t,
2642
2982
  calculate: r,
2643
2983
  setDisplay: o,
2644
2984
  display: a
2645
- } = N(), n = [
2985
+ } = X(), n = [
2646
2986
  { label: "sin", action: () => e("sin(") },
2647
2987
  { label: "cos", action: () => e("cos(") },
2648
2988
  { label: "tan", action: () => e("tan(") },
@@ -2651,34 +2991,37 @@ function Ne() {
2651
2991
  ], i = [
2652
2992
  { label: "x²", action: () => e("^2") },
2653
2993
  { label: "x³", action: () => e("^3") },
2994
+ // audit-allow: i18n — math notation
2654
2995
  { label: "xʸ", action: () => e("^") },
2655
2996
  { label: "√", action: () => e("sqrt(") },
2997
+ // audit-allow: i18n — math notation
2656
2998
  { label: "eˣ", action: () => e("exp(") }
2657
- ], c = [
2999
+ ], l = [
2658
3000
  { label: "(", action: () => e("(") },
2659
3001
  { label: ")", action: () => e(")") },
2660
3002
  { label: "π", action: () => e("π") },
2661
3003
  { label: "e", action: () => e("e") },
3004
+ // audit-allow: i18n — the calculator key, the same in every language
2662
3005
  { label: "AC", action: t }
2663
3006
  ];
2664
3007
  return /* @__PURE__ */ v("div", { children: [
2665
- /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(5, 1fr)" }, children: [...n, ...i, ...c].map((u, s) => /* @__PURE__ */ d(
3008
+ /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(5, 1fr)" }, children: [...n, ...i, ...l].map((g, s) => /* @__PURE__ */ d(
2666
3009
  "button",
2667
3010
  {
2668
- onClick: u.action,
3011
+ onClick: g.action,
2669
3012
  style: { ...B.key, ...B.keyFunction, padding: "12px" },
2670
- children: u.label
3013
+ children: g.label
2671
3014
  },
2672
3015
  s
2673
3016
  )) }),
2674
- /* @__PURE__ */ d(le, {})
3017
+ /* @__PURE__ */ d(pe, {})
2675
3018
  ] });
2676
3019
  }
2677
- function Xe() {
2678
- const { display: e, setDisplay: t, service: r } = N(), [o, a] = P("DEC"), n = (c) => {
3020
+ function Oe() {
3021
+ const { display: e, setDisplay: t, service: r } = X(), [o, a] = M("DEC"), n = (l) => {
2679
3022
  try {
2680
- const u = r.convertBase(e, o, c);
2681
- t(u), a(c);
3023
+ const g = r.convertBase(e, o, l);
3024
+ t(g), a(l);
2682
3025
  } catch {
2683
3026
  t("Error");
2684
3027
  }
@@ -2693,33 +3036,33 @@ function Xe() {
2693
3036
  padding: "8px",
2694
3037
  backgroundColor: "var(--nice-bg-secondary, #252525)"
2695
3038
  },
2696
- children: ["BIN", "OCT", "DEC", "HEX"].map((c) => /* @__PURE__ */ d(
3039
+ children: ["BIN", "OCT", "DEC", "HEX"].map((l) => /* @__PURE__ */ d(
2697
3040
  "button",
2698
3041
  {
2699
- onClick: () => n(c),
3042
+ onClick: () => n(l),
2700
3043
  style: {
2701
3044
  flex: 1,
2702
3045
  padding: "8px",
2703
3046
  border: "none",
2704
3047
  borderRadius: "4px",
2705
- backgroundColor: o === c ? "var(--nice-primary-hover, #1976d2)" : "var(--nice-border, #3c3c3c)",
3048
+ backgroundColor: o === l ? "var(--nice-primary-hover, #1976d2)" : "var(--nice-border, #3c3c3c)",
2706
3049
  color: "var(--nice-color-white, #fff)",
2707
3050
  cursor: "pointer"
2708
3051
  },
2709
- children: c
3052
+ children: l
2710
3053
  },
2711
- c
3054
+ l
2712
3055
  ))
2713
3056
  }
2714
3057
  ),
2715
- i.length > 0 && /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(6, 1fr)" }, children: i.map((c) => /* @__PURE__ */ d(
3058
+ i.length > 0 && /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(6, 1fr)" }, children: i.map((l) => /* @__PURE__ */ d(
2716
3059
  "button",
2717
3060
  {
2718
- onClick: () => t(e === "0" ? c : e + c),
3061
+ onClick: () => t(e === "0" ? l : e + l),
2719
3062
  style: B.key,
2720
- children: c
3063
+ children: l
2721
3064
  },
2722
- c
3065
+ l
2723
3066
  )) }),
2724
3067
  /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(4, 1fr)" }, children: [
2725
3068
  "7",
@@ -2738,31 +3081,33 @@ function Xe() {
2738
3081
  "NOT",
2739
3082
  "<<",
2740
3083
  ">>"
2741
- ].map((c) => {
2742
- const u = ["AND", "OR", "XOR", "NOT", "<<", ">>"].includes(c);
3084
+ ].map((l) => {
3085
+ const g = ["AND", "OR", "XOR", "NOT", "<<", ">>"].includes(l);
2743
3086
  return /* @__PURE__ */ d(
2744
3087
  "button",
2745
3088
  {
2746
- onClick: () => t(e === "0" ? c : e + c),
2747
- style: { ...B.key, ...u ? B.keyFunction : {} },
2748
- children: c
3089
+ onClick: () => t(e === "0" ? l : e + l),
3090
+ style: { ...B.key, ...g ? B.keyFunction : {} },
3091
+ children: l
2749
3092
  },
2750
- c
3093
+ l
2751
3094
  );
2752
3095
  }) })
2753
3096
  ] });
2754
3097
  }
2755
3098
  function Ge() {
2756
- const { t: e } = L(), [t, r] = P(z.create(2, 2)), [o, a] = P(z.create(2, 2)), [n, i] = P(""), c = (s, p, m, y, f) => {
2757
- const C = { ...s, data: s.data.map((x) => [...x]) };
2758
- C.data[m][y] = parseFloat(f) || 0, p(C);
2759
- }, u = [
2760
- { label: "A + B", fn: () => z.toString(z.add(t, o)) },
2761
- { label: "A - B", fn: () => z.toString(z.subtract(t, o)) },
2762
- { label: "A × B", fn: () => z.toString(z.multiply(t, o)) },
2763
- { label: "det(A)", fn: () => z.determinant(t).toFixed(4) },
2764
- { label: "Aᵀ", fn: () => z.toString(z.transpose(t)) },
2765
- { label: "A⁻¹", fn: () => z.toString(z.inverse(t)) }
3099
+ const { t: e } = E(), [t, r] = M($.create(2, 2)), [o, a] = M($.create(2, 2)), [n, i] = M(""), l = (s, p, u, x, f) => {
3100
+ const w = { ...s, data: s.data.map((y) => [...y]) };
3101
+ w.data[u][x] = parseFloat(f) || 0, p(w);
3102
+ }, g = [
3103
+ { label: "A + B", fn: () => $.toString($.add(t, o)) },
3104
+ { label: "A - B", fn: () => $.toString($.subtract(t, o)) },
3105
+ { label: "A × B", fn: () => $.toString($.multiply(t, o)) },
3106
+ // audit-allow: i18n — math notation
3107
+ { label: "det(A)", fn: () => $.determinant(t).toFixed(4) },
3108
+ // audit-allow: i18n — math notation
3109
+ { label: "Aᵀ", fn: () => $.toString($.transpose(t)) },
3110
+ { label: "A⁻¹", fn: () => $.toString($.inverse(t)) }
2766
3111
  ];
2767
3112
  return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2768
3113
  /* @__PURE__ */ v("div", { style: { display: "flex", gap: "12px", marginBottom: "12px" }, children: [
@@ -2772,7 +3117,7 @@ function Ge() {
2772
3117
  re,
2773
3118
  {
2774
3119
  matrix: t,
2775
- onChange: (s, p, m) => c(t, r, s, p, m)
3120
+ onChange: (s, p, u) => l(t, r, s, p, u)
2776
3121
  }
2777
3122
  )
2778
3123
  ] }),
@@ -2782,12 +3127,12 @@ function Ge() {
2782
3127
  re,
2783
3128
  {
2784
3129
  matrix: o,
2785
- onChange: (s, p, m) => c(o, a, s, p, m)
3130
+ onChange: (s, p, u) => l(o, a, s, p, u)
2786
3131
  }
2787
3132
  )
2788
3133
  ] })
2789
3134
  ] }),
2790
- /* @__PURE__ */ d("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap", marginBottom: "12px" }, children: u.map((s) => /* @__PURE__ */ d(
3135
+ /* @__PURE__ */ d("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap", marginBottom: "12px" }, children: g.map((s) => /* @__PURE__ */ d(
2791
3136
  "button",
2792
3137
  {
2793
3138
  onClick: () => {
@@ -2853,8 +3198,8 @@ function re({
2853
3198
  }
2854
3199
  );
2855
3200
  }
2856
- function je() {
2857
- const { t: e } = L(), [t, r] = P("x^2"), [o, a] = P("");
3201
+ function Ue() {
3202
+ const { t: e } = E(), [t, r] = M("x^2"), [o, a] = M("");
2858
3203
  return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2859
3204
  /* @__PURE__ */ d(
2860
3205
  "input",
@@ -2921,24 +3266,24 @@ function je() {
2921
3266
  )
2922
3267
  ] });
2923
3268
  }
2924
- function Fe() {
2925
- const { t: e } = L(), { service: t } = N(), [r, o] = P("1"), [a, n] = P("m"), [i, c] = P("ft"), [u, s] = P("Length"), [p, m] = P(""), y = t.getUnitCategories(), f = t.getUnitsByCategory(u), C = () => {
3269
+ function Ye() {
3270
+ const { t: e } = E(), { service: t } = X(), [r, o] = M("1"), [a, n] = M("m"), [i, l] = M("ft"), [g, s] = M("Length"), [p, u] = M(""), x = t.getUnitCategories(), f = t.getUnitsByCategory(g), w = () => {
2926
3271
  try {
2927
- const x = t.convertUnits(parseFloat(r), a, i);
2928
- m(`${r} ${a} = ${t.format(x)} ${i}`);
2929
- } catch (x) {
2930
- m(x.message);
3272
+ const y = t.convertUnits(parseFloat(r), a, i);
3273
+ u(`${r} ${a} = ${t.format(y)} ${i}`);
3274
+ } catch (y) {
3275
+ u(y.message);
2931
3276
  }
2932
3277
  };
2933
3278
  return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2934
3279
  /* @__PURE__ */ d(
2935
3280
  "select",
2936
3281
  {
2937
- value: u,
2938
- onChange: (x) => {
2939
- s(x.target.value);
2940
- const b = t.getUnitsByCategory(x.target.value);
2941
- b.length >= 2 && (n(b[0].symbol), c(b[1].symbol));
3282
+ value: g,
3283
+ onChange: (y) => {
3284
+ s(y.target.value);
3285
+ const b = t.getUnitsByCategory(y.target.value);
3286
+ b.length >= 2 && (n(b[0].symbol), l(b[1].symbol));
2942
3287
  },
2943
3288
  style: {
2944
3289
  width: "100%",
@@ -2949,7 +3294,7 @@ function Fe() {
2949
3294
  border: "1px solid var(--nice-border-color, #555)",
2950
3295
  borderRadius: "4px"
2951
3296
  },
2952
- children: y.map((x) => /* @__PURE__ */ d("option", { value: x, children: x }, x))
3297
+ children: x.map((y) => /* @__PURE__ */ d("option", { value: y, children: y }, y))
2953
3298
  }
2954
3299
  ),
2955
3300
  /* @__PURE__ */ v("div", { style: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }, children: [
@@ -2958,7 +3303,7 @@ function Fe() {
2958
3303
  {
2959
3304
  type: "number",
2960
3305
  value: r,
2961
- onChange: (x) => o(x.target.value),
3306
+ onChange: (y) => o(y.target.value),
2962
3307
  style: {
2963
3308
  flex: 1,
2964
3309
  padding: "8px",
@@ -2973,7 +3318,7 @@ function Fe() {
2973
3318
  "select",
2974
3319
  {
2975
3320
  value: a,
2976
- onChange: (x) => n(x.target.value),
3321
+ onChange: (y) => n(y.target.value),
2977
3322
  style: {
2978
3323
  padding: "8px",
2979
3324
  backgroundColor: "var(--nice-border, #3c3c3c)",
@@ -2981,22 +3326,22 @@ function Fe() {
2981
3326
  border: "1px solid var(--nice-border-color, #555)",
2982
3327
  borderRadius: "4px"
2983
3328
  },
2984
- children: f.map((x) => /* @__PURE__ */ v("option", { value: x.symbol, children: [
2985
- x.name,
3329
+ children: f.map((y) => /* @__PURE__ */ v("option", { value: y.symbol, children: [
3330
+ y.name,
2986
3331
  " (",
2987
- x.symbol,
3332
+ y.symbol,
2988
3333
  ")"
2989
- ] }, x.symbol))
3334
+ ] }, y.symbol))
2990
3335
  }
2991
3336
  )
2992
3337
  ] }),
2993
3338
  /* @__PURE__ */ v("div", { style: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }, children: [
2994
- /* @__PURE__ */ d("span", { style: { color: "var(--nice-text-secondary, #888)" }, children: /* @__PURE__ */ d(G, { name: "arrow-right", size: 12 }) }),
3339
+ /* @__PURE__ */ d("span", { style: { color: "var(--nice-text-secondary, #888)" }, children: /* @__PURE__ */ d(j, { name: "arrow-right", size: 12 }) }),
2995
3340
  /* @__PURE__ */ d(
2996
3341
  "select",
2997
3342
  {
2998
3343
  value: i,
2999
- onChange: (x) => c(x.target.value),
3344
+ onChange: (y) => l(y.target.value),
3000
3345
  style: {
3001
3346
  flex: 1,
3002
3347
  padding: "8px",
@@ -3005,19 +3350,19 @@ function Fe() {
3005
3350
  border: "1px solid var(--nice-border-color, #555)",
3006
3351
  borderRadius: "4px"
3007
3352
  },
3008
- children: f.map((x) => /* @__PURE__ */ v("option", { value: x.symbol, children: [
3009
- x.name,
3353
+ children: f.map((y) => /* @__PURE__ */ v("option", { value: y.symbol, children: [
3354
+ y.name,
3010
3355
  " (",
3011
- x.symbol,
3356
+ y.symbol,
3012
3357
  ")"
3013
- ] }, x.symbol))
3358
+ ] }, y.symbol))
3014
3359
  }
3015
3360
  )
3016
3361
  ] }),
3017
3362
  /* @__PURE__ */ d(
3018
3363
  "button",
3019
3364
  {
3020
- onClick: C,
3365
+ onClick: w,
3021
3366
  style: {
3022
3367
  width: "100%",
3023
3368
  padding: "12px",
@@ -3045,7 +3390,7 @@ function Fe() {
3045
3390
  )
3046
3391
  ] });
3047
3392
  }
3048
- const E = {
3393
+ const I = {
3049
3394
  /** Distance between two points */
3050
3395
  distance(e, t) {
3051
3396
  return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
@@ -3082,21 +3427,21 @@ const E = {
3082
3427
  },
3083
3428
  /** Circle-line intersection */
3084
3429
  circleLineIntersection(e, t, r, o) {
3085
- const a = o.x - r.x, n = o.y - r.y, i = r.x - e.x, c = r.y - e.y, u = a * a + n * n, s = 2 * (i * a + c * n), p = i * i + c * c - t * t, m = s * s - 4 * u * p;
3086
- if (m < 0)
3430
+ const a = o.x - r.x, n = o.y - r.y, i = r.x - e.x, l = r.y - e.y, g = a * a + n * n, s = 2 * (i * a + l * n), p = i * i + l * l - t * t, u = s * s - 4 * g * p;
3431
+ if (u < 0)
3087
3432
  return [];
3088
- const y = Math.sqrt(m), f = (-s - y) / (2 * u), C = (-s + y) / (2 * u), x = [];
3089
- return f >= 0 && f <= 1 && x.push({ x: r.x + f * a, y: r.y + f * n }), C >= 0 && C <= 1 && Math.abs(C - f) > 1e-10 && x.push({ x: r.x + C * a, y: r.y + C * n }), x;
3433
+ const x = Math.sqrt(u), f = (-s - x) / (2 * g), w = (-s + x) / (2 * g), y = [];
3434
+ return f >= 0 && f <= 1 && y.push({ x: r.x + f * a, y: r.y + f * n }), w >= 0 && w <= 1 && Math.abs(w - f) > 1e-10 && y.push({ x: r.x + w * a, y: r.y + w * n }), y;
3090
3435
  },
3091
3436
  /** Circle-circle intersection */
3092
3437
  circleCircleIntersection(e, t, r, o) {
3093
3438
  const a = this.distance(e, r);
3094
3439
  if (a > t + o || a < Math.abs(t - o) || a === 0)
3095
3440
  return [];
3096
- const n = (t * t - o * o + a * a) / (2 * a), i = Math.sqrt(t * t - n * n), c = e.x + n * (r.x - e.x) / a, u = e.y + n * (r.y - e.y) / a;
3441
+ const n = (t * t - o * o + a * a) / (2 * a), i = Math.sqrt(t * t - n * n), l = e.x + n * (r.x - e.x) / a, g = e.y + n * (r.y - e.y) / a;
3097
3442
  return [
3098
- { x: c + i * (r.y - e.y) / a, y: u - i * (r.x - e.x) / a },
3099
- { x: c - i * (r.y - e.y) / a, y: u + i * (r.x - e.x) / a }
3443
+ { x: l + i * (r.y - e.y) / a, y: g - i * (r.x - e.x) / a },
3444
+ { x: l - i * (r.y - e.y) / a, y: g + i * (r.x - e.x) / a }
3100
3445
  ];
3101
3446
  },
3102
3447
  /** Perpendicular line through point */
@@ -3193,10 +3538,10 @@ const E = {
3193
3538
  };
3194
3539
  }
3195
3540
  };
3196
- class Oe {
3541
+ class Ke {
3197
3542
  constructor() {
3198
- T(this, "elements", /* @__PURE__ */ new Map());
3199
- T(this, "nextLabel", 1);
3543
+ z(this, "elements", /* @__PURE__ */ new Map());
3544
+ z(this, "nextLabel", 1);
3200
3545
  }
3201
3546
  /** Add element */
3202
3547
  addElement(t) {
@@ -3330,7 +3675,7 @@ class Oe {
3330
3675
  const o = this.getPoint(t), a = this.getPoint(r);
3331
3676
  if (!o || !a)
3332
3677
  return null;
3333
- const n = E.midpoint(o, a), i = this.createPoint(n.x, n.y);
3678
+ const n = I.midpoint(o, a), i = this.createPoint(n.x, n.y);
3334
3679
  return i.dependencies = [t, r], i.color = { r: 0, g: 150, b: 0 }, i;
3335
3680
  }
3336
3681
  /** Create perpendicular */
@@ -3338,7 +3683,7 @@ class Oe {
3338
3683
  const a = this.getPoint(t), n = this.getPoint(r), i = this.getPoint(o);
3339
3684
  if (!a || !n || !i)
3340
3685
  return null;
3341
- const c = E.perpendicularThrough(a, n, i), u = this.createPoint(c.p2.x, c.p2.y), s = this.createLine(o, u.id);
3686
+ const l = I.perpendicularThrough(a, n, i), g = this.createPoint(l.p2.x, l.p2.y), s = this.createLine(o, g.id);
3342
3687
  return s.dependencies = [t, r, o], s;
3343
3688
  }
3344
3689
  /** Create parallel */
@@ -3346,7 +3691,7 @@ class Oe {
3346
3691
  const a = this.getPoint(t), n = this.getPoint(r), i = this.getPoint(o);
3347
3692
  if (!a || !n || !i)
3348
3693
  return null;
3349
- const c = E.parallelThrough(a, n, i), u = this.createPoint(c.p2.x, c.p2.y), s = this.createLine(o, u.id);
3694
+ const l = I.parallelThrough(a, n, i), g = this.createPoint(l.p2.x, l.p2.y), s = this.createLine(o, g.id);
3350
3695
  return s.dependencies = [t, r, o], s;
3351
3696
  }
3352
3697
  /** Create intersection point */
@@ -3356,36 +3701,36 @@ class Oe {
3356
3701
  return [];
3357
3702
  const n = [], i = (s) => {
3358
3703
  if (s.type === "line" || s.type === "segment" || s.type === "ray") {
3359
- const p = s, m = this.getPoint(p.point1Id ?? p.originId), y = this.getPoint(p.point2Id ?? p.throughId);
3360
- if (m && y)
3361
- return [m, y];
3704
+ const p = s, u = this.getPoint(p.point1Id ?? p.originId), x = this.getPoint(p.point2Id ?? p.throughId);
3705
+ if (u && x)
3706
+ return [u, x];
3362
3707
  }
3363
3708
  return null;
3364
- }, c = i(o), u = i(a);
3365
- if (c && u) {
3366
- const s = E.lineIntersection(c[0], c[1], u[0], u[1]);
3709
+ }, l = i(o), g = i(a);
3710
+ if (l && g) {
3711
+ const s = I.lineIntersection(l[0], l[1], g[0], g[1]);
3367
3712
  if (s) {
3368
3713
  const p = this.createPoint(s.x, s.y);
3369
3714
  p.dependencies = [t, r], p.color = { r: 255, g: 0, b: 0 }, n.push(p);
3370
3715
  }
3371
3716
  }
3372
- if (o.type === "circle" && u) {
3717
+ if (o.type === "circle" && g) {
3373
3718
  const s = o, p = this.getPoint(s.centerId);
3374
3719
  if (p) {
3375
- const m = E.circleLineIntersection(p, s.radius, u[0], u[1]);
3376
- for (const y of m) {
3377
- const f = this.createPoint(y.x, y.y);
3720
+ const u = I.circleLineIntersection(p, s.radius, g[0], g[1]);
3721
+ for (const x of u) {
3722
+ const f = this.createPoint(x.x, x.y);
3378
3723
  f.dependencies = [t, r], f.color = { r: 255, g: 0, b: 0 }, n.push(f);
3379
3724
  }
3380
3725
  }
3381
3726
  }
3382
3727
  if (o.type === "circle" && a.type === "circle") {
3383
- const s = o, p = a, m = this.getPoint(s.centerId), y = this.getPoint(p.centerId);
3384
- if (m && y) {
3385
- const f = E.circleCircleIntersection(m, s.radius, y, p.radius);
3386
- for (const C of f) {
3387
- const x = this.createPoint(C.x, C.y);
3388
- x.dependencies = [t, r], x.color = { r: 255, g: 0, b: 0 }, n.push(x);
3728
+ const s = o, p = a, u = this.getPoint(s.centerId), x = this.getPoint(p.centerId);
3729
+ if (u && x) {
3730
+ const f = I.circleCircleIntersection(u, s.radius, x, p.radius);
3731
+ for (const w of f) {
3732
+ const y = this.createPoint(w.x, w.y);
3733
+ y.dependencies = [t, r], y.color = { r: 255, g: 0, b: 0 }, n.push(y);
3389
3734
  }
3390
3735
  }
3391
3736
  }
@@ -3397,13 +3742,13 @@ class Oe {
3397
3742
  case "distance": {
3398
3743
  const o = this.getPoint(r[0]), a = this.getPoint(r[1]);
3399
3744
  if (o && a)
3400
- return E.distance(o, a);
3745
+ return I.distance(o, a);
3401
3746
  break;
3402
3747
  }
3403
3748
  case "angle": {
3404
3749
  const o = this.getPoint(r[0]), a = this.getPoint(r[1]), n = this.getPoint(r[2]);
3405
3750
  if (o && a && n)
3406
- return E.angleDegrees(o, a, n);
3751
+ return I.angleDegrees(o, a, n);
3407
3752
  break;
3408
3753
  }
3409
3754
  case "area":
@@ -3411,7 +3756,7 @@ class Oe {
3411
3756
  const o = this.elements.get(r[0]);
3412
3757
  if ((o == null ? void 0 : o.type) === "polygon") {
3413
3758
  const a = o.pointIds.map((n) => this.getPoint(n)).filter(Boolean);
3414
- return t === "area" ? E.polygonArea(a) : E.polygonPerimeter(a);
3759
+ return t === "area" ? I.polygonArea(a) : I.polygonPerimeter(a);
3415
3760
  }
3416
3761
  break;
3417
3762
  }
@@ -3426,19 +3771,19 @@ class Oe {
3426
3771
  a.push(
3427
3772
  `<rect width="100%" height="100%" fill="rgb(${o.backgroundColor.r},${o.backgroundColor.g},${o.backgroundColor.b})"/>`
3428
3773
  );
3429
- const n = (i, c) => ({
3774
+ const n = (i, l) => ({
3430
3775
  x: t / 2 + (i - o.centerX) * o.scale,
3431
- y: r / 2 - (c - o.centerY) * o.scale
3776
+ y: r / 2 - (l - o.centerY) * o.scale
3432
3777
  });
3433
3778
  if (o.showGrid) {
3434
3779
  a.push('<g stroke="var(--nice-border, #ddd)" stroke-width="0.5">');
3435
3780
  for (let i = Math.floor(-t / 2 / o.scale + o.centerX); i <= t / 2 / o.scale + o.centerX; i += o.gridSpacing) {
3436
- const c = n(i, 0);
3437
- a.push(`<line x1="${c.x}" y1="0" x2="${c.x}" y2="${r}"/>`);
3781
+ const l = n(i, 0);
3782
+ a.push(`<line x1="${l.x}" y1="0" x2="${l.x}" y2="${r}"/>`);
3438
3783
  }
3439
3784
  for (let i = Math.floor(-r / 2 / o.scale + o.centerY); i <= r / 2 / o.scale + o.centerY; i += o.gridSpacing) {
3440
- const c = n(0, i);
3441
- a.push(`<line x1="0" y1="${c.y}" x2="${t}" y2="${c.y}"/>`);
3785
+ const l = n(0, i);
3786
+ a.push(`<line x1="0" y1="${l.y}" x2="${t}" y2="${l.y}"/>`);
3442
3787
  }
3443
3788
  a.push("</g>");
3444
3789
  }
@@ -3449,39 +3794,39 @@ class Oe {
3449
3794
  for (const i of this.getAllElements()) {
3450
3795
  if (!i.visible)
3451
3796
  continue;
3452
- const c = `rgb(${i.color.r},${i.color.g},${i.color.b})`;
3797
+ const l = `rgb(${i.color.r},${i.color.g},${i.color.b})`;
3453
3798
  switch (i.type) {
3454
3799
  case "point": {
3455
- const u = n(i.x, i.y);
3456
- a.push(`<circle cx="${u.x}" cy="${u.y}" r="${i.size}" fill="${c}"/>`), i.label && a.push(`<text x="${u.x + 8}" y="${u.y - 8}" font-size="12">${i.label}</text>`);
3800
+ const g = n(i.x, i.y);
3801
+ a.push(`<circle cx="${g.x}" cy="${g.y}" r="${i.size}" fill="${l}"/>`), i.label && a.push(`<text x="${g.x + 8}" y="${g.y - 8}" font-size="12">${i.label}</text>`);
3457
3802
  break;
3458
3803
  }
3459
3804
  case "segment": {
3460
- const u = this.getPoint(i.point1Id), s = this.getPoint(i.point2Id);
3461
- if (u && s) {
3462
- const p = n(u.x, u.y), m = n(s.x, s.y);
3805
+ const g = this.getPoint(i.point1Id), s = this.getPoint(i.point2Id);
3806
+ if (g && s) {
3807
+ const p = n(g.x, g.y), u = n(s.x, s.y);
3463
3808
  a.push(
3464
- `<line x1="${p.x}" y1="${p.y}" x2="${m.x}" y2="${m.y}" stroke="${c}" stroke-width="${i.width}"/>`
3809
+ `<line x1="${p.x}" y1="${p.y}" x2="${u.x}" y2="${u.y}" stroke="${l}" stroke-width="${i.width}"/>`
3465
3810
  );
3466
3811
  }
3467
3812
  break;
3468
3813
  }
3469
3814
  case "circle": {
3470
- const u = this.getPoint(i.centerId);
3471
- if (u) {
3472
- const s = n(u.x, u.y), p = i.radius * o.scale, m = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
3815
+ const g = this.getPoint(i.centerId);
3816
+ if (g) {
3817
+ const s = n(g.x, g.y), p = i.radius * o.scale, u = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
3473
3818
  a.push(
3474
- `<circle cx="${s.x}" cy="${s.y}" r="${p}" fill="${m}" stroke="${c}" stroke-width="${i.width}"/>`
3819
+ `<circle cx="${s.x}" cy="${s.y}" r="${p}" fill="${u}" stroke="${l}" stroke-width="${i.width}"/>`
3475
3820
  );
3476
3821
  }
3477
3822
  break;
3478
3823
  }
3479
3824
  case "polygon": {
3480
- const u = i.pointIds.map((s) => this.getPoint(s)).filter(Boolean);
3481
- if (u.length > 0) {
3482
- const p = u.map((y) => n(y.x, y.y)).map((y, f) => `${f === 0 ? "M" : "L"}${y.x},${y.y}`).join(" ") + " Z", m = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
3825
+ const g = i.pointIds.map((s) => this.getPoint(s)).filter(Boolean);
3826
+ if (g.length > 0) {
3827
+ const p = g.map((x) => n(x.x, x.y)).map((x, f) => `${f === 0 ? "M" : "L"}${x.x},${x.y}`).join(" ") + " Z", u = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
3483
3828
  a.push(
3484
- `<path d="${p}" fill="${m}" stroke="${c}" stroke-width="${i.width}"/>`
3829
+ `<path d="${p}" fill="${u}" stroke="${l}" stroke-width="${i.width}"/>`
3485
3830
  );
3486
3831
  }
3487
3832
  break;
@@ -3499,12 +3844,12 @@ class Oe {
3499
3844
  return this.nextLabel++, r < 26 ? t[r] : t[r % 26] + Math.floor(r / 26);
3500
3845
  }
3501
3846
  }
3502
- function nt() {
3503
- return new Oe();
3847
+ function lt() {
3848
+ return new Ke();
3504
3849
  }
3505
- const de = /* @__PURE__ */ F(null);
3850
+ const ge = /* @__PURE__ */ O(null);
3506
3851
  function H() {
3507
- const e = j(de);
3852
+ const e = F(ge);
3508
3853
  if (!e)
3509
3854
  throw new Error("useGeometry must be used within GeometryProvider");
3510
3855
  return e;
@@ -3558,14 +3903,14 @@ const q = {
3558
3903
  color: "var(--nice-text-secondary, #666)"
3559
3904
  }
3560
3905
  };
3561
- function it({
3906
+ function ct({
3562
3907
  service: e,
3563
3908
  width: t = 800,
3564
3909
  height: r = 600,
3565
3910
  className: o,
3566
3911
  style: a
3567
3912
  }) {
3568
- const [n, i] = P([]), [c, u] = P("point"), [s, p] = P([]), [m, y] = P({
3913
+ const [n, i] = M([]), [l, g] = M("point"), [s, p] = M([]), [u, x] = M({
3569
3914
  centerX: 0,
3570
3915
  centerY: 0,
3571
3916
  scale: 40,
@@ -3577,119 +3922,134 @@ function it({
3577
3922
  backgroundColor: { r: 255, g: 255, b: 255 }
3578
3923
  }), f = R(() => {
3579
3924
  i(e.getAllElements());
3580
- }, [e]), C = R((b) => {
3581
- y((l) => ({ ...l, ...b }));
3925
+ }, [e]), w = R((b) => {
3926
+ x((c) => ({ ...c, ...b }));
3582
3927
  }, []);
3583
- V(() => {
3928
+ Y(() => {
3584
3929
  f();
3585
3930
  }, [f]);
3586
- const x = {
3931
+ const y = {
3587
3932
  service: e,
3588
3933
  elements: n,
3589
- tool: c,
3590
- setTool: u,
3591
- view: m,
3592
- setView: C,
3934
+ tool: l,
3935
+ setTool: g,
3936
+ view: u,
3937
+ setView: w,
3593
3938
  selectedIds: s,
3594
3939
  setSelectedIds: p,
3595
3940
  refresh: f
3596
3941
  };
3597
- return /* @__PURE__ */ d(de.Provider, { value: x, children: /* @__PURE__ */ v("div", { className: o, style: { ...q.container, ...a }, children: [
3598
- /* @__PURE__ */ d(Ue, {}),
3942
+ return /* @__PURE__ */ d(ge.Provider, { value: y, children: /* @__PURE__ */ v("div", { className: o, style: { ...q.container, ...a }, children: [
3943
+ /* @__PURE__ */ d(Ve, {}),
3599
3944
  /* @__PURE__ */ v("div", { style: q.main, children: [
3600
- /* @__PURE__ */ d(Ve, { width: t, height: r }),
3601
- /* @__PURE__ */ d(Ye, { width: t, height: r })
3945
+ /* @__PURE__ */ d(We, { width: t, height: r }),
3946
+ /* @__PURE__ */ d(He, { width: t, height: r })
3602
3947
  ] })
3603
3948
  ] }) });
3604
3949
  }
3605
- function Ue() {
3606
- const { tool: e, setTool: t } = H(), r = [
3607
- { id: "select", icon: "cursor", title: "Select" },
3608
- { id: "point", icon: "•", title: "Point" },
3609
- { id: "segment", icon: "—", title: "Segment" },
3610
- { id: "line", icon: "line", title: "Line" },
3611
- { id: "ray", icon: "arrow-right", title: "Ray" },
3612
- { id: "circle", icon: "circle", title: "Circle" },
3613
- { id: "polygon", icon: "triangle", title: "Polygon" },
3614
- { id: "perpendicular", icon: "⊥", title: "Perpendicular" },
3615
- { id: "parallel", icon: "∥", title: "Parallel" },
3616
- { id: "midpoint", icon: "⊙", title: "Midpoint" },
3617
- { id: "bisector", icon: "∠", title: "Angle Bisector" },
3618
- { id: "intersection", icon: "close", title: "Intersection" },
3619
- { id: "reflect", icon: "shuffle", title: "Reflect" },
3620
- { id: "rotate", icon: "refresh", title: "Rotate" },
3621
- { id: "measure", icon: "ruler", title: "Measure" }
3950
+ function Ve() {
3951
+ const { t: e } = E(), { tool: t, setTool: r } = H(), o = [
3952
+ { id: "select", icon: "cursor", title: e("geometry.select", "Select") },
3953
+ { id: "point", icon: "point", title: e("geometry.point", "Point") },
3954
+ { id: "segment", icon: "segment", title: e("geometry.segment", "Segment") },
3955
+ { id: "line", icon: "line", title: e("geometry.line", "Line") },
3956
+ { id: "ray", icon: "arrow-right", title: e("geometry.ray", "Ray") },
3957
+ { id: "circle", icon: "circle", title: e("geometry.circle", "Circle") },
3958
+ { id: "polygon", icon: "triangle", title: e("geometry.polygon", "Polygon") },
3959
+ {
3960
+ id: "perpendicular",
3961
+ icon: "perpendicular",
3962
+ title: e("geometry.perpendicular", "Perpendicular")
3963
+ },
3964
+ { id: "parallel", icon: "parallel", title: e("geometry.parallel", "Parallel") },
3965
+ { id: "midpoint", icon: "midpoint", title: e("geometry.midpoint", "Midpoint") },
3966
+ {
3967
+ id: "bisector",
3968
+ icon: "angle-bisector",
3969
+ title: e("geometry.angleBisector", "Angle Bisector")
3970
+ },
3971
+ { id: "intersection", icon: "close", title: e("geometry.intersection", "Intersection") },
3972
+ { id: "reflect", icon: "shuffle", title: e("geometry.reflect", "Reflect") },
3973
+ { id: "rotate", icon: "refresh", title: e("geometry.rotate", "Rotate") },
3974
+ { id: "measure", icon: "ruler", title: e("geometry.measure", "Measure") }
3622
3975
  ];
3623
- return /* @__PURE__ */ d("div", { style: q.toolbar, children: r.map((o) => /* @__PURE__ */ d(
3976
+ return /* @__PURE__ */ d("div", { style: q.toolbar, children: o.map((a) => /* @__PURE__ */ d(
3624
3977
  "button",
3625
3978
  {
3626
- onClick: () => t(o.id),
3627
- title: o.title,
3979
+ onClick: () => r(a.id),
3980
+ title: a.title,
3628
3981
  style: {
3629
3982
  ...q.toolButton,
3630
- backgroundColor: e === o.id ? "var(--nice-primary-hover, #1976d2)" : "transparent",
3631
- color: e === o.id ? "var(--nice-color-white, #fff)" : "var(--nice-text, #333)"
3983
+ backgroundColor: t === a.id ? "var(--nice-primary-hover, #1976d2)" : "transparent",
3984
+ color: t === a.id ? "var(--nice-color-white, #fff)" : "var(--nice-text, #333)"
3632
3985
  },
3633
- children: /^[a-z][a-z0-9-]*$/.test(o.icon) ? /* @__PURE__ */ d(G, { name: o.icon, size: 16 }) : o.icon
3986
+ children: /* @__PURE__ */ d(j, { name: a.icon, size: 16 })
3634
3987
  },
3635
- o.id
3988
+ a.id
3636
3989
  )) });
3637
3990
  }
3638
- function Ve({ width: e, height: t }) {
3639
- const r = U(null), { service: o, elements: a, tool: n, view: i, selectedIds: c, setSelectedIds: u, refresh: s } = H(), [p, m] = P([]), y = R(
3640
- (b, l) => {
3641
- const g = (b - e / 2) / i.scale + i.centerX, w = -(l - t / 2) / i.scale + i.centerY;
3991
+ function We({ width: e, height: t }) {
3992
+ const r = U(null), { service: o, elements: a, tool: n, view: i, selectedIds: l, setSelectedIds: g, refresh: s } = H(), [p, u] = M([]), x = R(
3993
+ (b, c) => {
3994
+ const m = (b - e / 2) / i.scale + i.centerX, k = -(c - t / 2) / i.scale + i.centerY;
3642
3995
  return i.snapToGrid ? {
3643
- x: Math.round(g / i.gridSpacing) * i.gridSpacing,
3644
- y: Math.round(w / i.gridSpacing) * i.gridSpacing
3645
- } : { x: g, y: w };
3996
+ x: Math.round(m / i.gridSpacing) * i.gridSpacing,
3997
+ y: Math.round(k / i.gridSpacing) * i.gridSpacing
3998
+ } : { x: m, y: k };
3646
3999
  },
3647
4000
  [e, t, i]
3648
4001
  ), f = R(
3649
- (b, l) => ({
4002
+ (b, c) => ({
3650
4003
  x: e / 2 + (b - i.centerX) * i.scale,
3651
- y: t / 2 - (l - i.centerY) * i.scale
4004
+ y: t / 2 - (c - i.centerY) * i.scale
3652
4005
  }),
3653
4006
  [e, t, i]
3654
- ), C = R(
4007
+ ), w = R(
4008
+ (b) => {
4009
+ for (const m of a)
4010
+ if (m.type === "point" && I.distance(m, b) < 0.5)
4011
+ return m;
4012
+ },
4013
+ [a]
4014
+ ), y = R(
3655
4015
  (b) => {
3656
- var w;
3657
- const l = (w = r.current) == null ? void 0 : w.getBoundingClientRect();
3658
- if (!l)
4016
+ var k;
4017
+ const c = (k = r.current) == null ? void 0 : k.getBoundingClientRect();
4018
+ if (!c)
3659
4019
  return;
3660
- const g = y(b.clientX - l.left, b.clientY - l.top);
4020
+ const m = x(b.clientX - c.left, b.clientY - c.top);
3661
4021
  switch (n) {
3662
4022
  case "point": {
3663
- o.createPoint(g.x, g.y), s();
4023
+ o.createPoint(m.x, m.y), s();
3664
4024
  break;
3665
4025
  }
3666
4026
  case "segment":
3667
4027
  case "line":
3668
4028
  case "ray": {
3669
- const M = x(g);
3670
- if (M)
3671
- m((h) => {
3672
- const k = [...h, M.id];
3673
- return k.length === 2 ? (n === "segment" ? o.createSegment(k[0], k[1]) : n === "line" ? o.createLine(k[0], k[1]) : n === "ray" && o.createRay(k[0], k[1]), s(), []) : k;
4029
+ const C = w(m);
4030
+ if (C)
4031
+ u((h) => {
4032
+ const P = [...h, C.id];
4033
+ return P.length === 2 ? (n === "segment" ? o.createSegment(P[0], P[1]) : n === "line" ? o.createLine(P[0], P[1]) : n === "ray" && o.createRay(P[0], P[1]), s(), []) : P;
3674
4034
  });
3675
4035
  else {
3676
- const h = o.createPoint(g.x, g.y);
3677
- m((k) => {
3678
- const S = [...k, h.id];
4036
+ const h = o.createPoint(m.x, m.y);
4037
+ u((P) => {
4038
+ const S = [...P, h.id];
3679
4039
  return S.length === 2 ? (n === "segment" ? o.createSegment(S[0], S[1]) : n === "line" ? o.createLine(S[0], S[1]) : n === "ray" && o.createRay(S[0], S[1]), s(), []) : S;
3680
4040
  }), s();
3681
4041
  }
3682
4042
  break;
3683
4043
  }
3684
4044
  case "circle": {
3685
- const M = x(g);
3686
- if (M)
3687
- m((h) => {
4045
+ const C = w(m);
4046
+ if (C)
4047
+ u((h) => {
3688
4048
  if (h.length === 0)
3689
- return [M.id];
3690
- const k = o.getPoint(h[0]);
3691
- if (k) {
3692
- const S = E.distance(k, g);
4049
+ return [C.id];
4050
+ const P = o.getPoint(h[0]);
4051
+ if (P) {
4052
+ const S = I.distance(P, m);
3693
4053
  o.createCircle(h[0], S), s();
3694
4054
  }
3695
4055
  return [];
@@ -3697,202 +4057,188 @@ function Ve({ width: e, height: t }) {
3697
4057
  else if (p.length === 1) {
3698
4058
  const h = o.getPoint(p[0]);
3699
4059
  if (h) {
3700
- const k = E.distance(h, g);
3701
- o.createCircle(p[0], k), s(), m([]);
4060
+ const P = I.distance(h, m);
4061
+ o.createCircle(p[0], P), s(), u([]);
3702
4062
  }
3703
4063
  } else {
3704
- const h = o.createPoint(g.x, g.y);
3705
- m([h.id]), s();
4064
+ const h = o.createPoint(m.x, m.y);
4065
+ u([h.id]), s();
3706
4066
  }
3707
4067
  break;
3708
4068
  }
3709
4069
  case "midpoint": {
3710
- const M = x(g);
3711
- M && m((h) => {
3712
- const k = [...h, M.id];
3713
- return k.length === 2 ? (o.createMidpoint(k[0], k[1]), s(), []) : k;
4070
+ const C = w(m);
4071
+ C && u((h) => {
4072
+ const P = [...h, C.id];
4073
+ return P.length === 2 ? (o.createMidpoint(P[0], P[1]), s(), []) : P;
3714
4074
  });
3715
4075
  break;
3716
4076
  }
3717
4077
  case "select": {
3718
- const M = x(g);
3719
- u(M ? [M.id] : []);
4078
+ const C = w(m);
4079
+ g(C ? [C.id] : []);
3720
4080
  break;
3721
4081
  }
3722
4082
  }
3723
4083
  },
3724
- [n, o, s, y, p, u]
3725
- ), x = (b) => {
3726
- for (const g of a)
3727
- if (g.type === "point" && E.distance(g, b) < 0.5)
3728
- return g;
3729
- };
3730
- return V(() => {
3731
- const b = r.current, l = b == null ? void 0 : b.getContext("2d");
3732
- if (!(!b || !l)) {
3733
- if (l.fillStyle = `rgb(${i.backgroundColor.r},${i.backgroundColor.g},${i.backgroundColor.b})`, l.fillRect(0, 0, e, t), i.showGrid) {
3734
- l.strokeStyle = I("var(--nice-border, #e0e0e0)", l.canvas), l.lineWidth = 0.5;
3735
- const g = i.gridSpacing * i.scale, w = (e / 2 - i.centerX * i.scale) % g, M = (t / 2 + i.centerY * i.scale) % g;
3736
- for (let h = w; h < e; h += g)
3737
- l.beginPath(), l.moveTo(h, 0), l.lineTo(h, t), l.stroke();
3738
- for (let h = M; h < t; h += g)
3739
- l.beginPath(), l.moveTo(0, h), l.lineTo(e, h), l.stroke();
4084
+ [n, o, s, x, p, g, w]
4085
+ );
4086
+ return Y(() => {
4087
+ const b = r.current, c = b == null ? void 0 : b.getContext("2d");
4088
+ if (!(!b || !c)) {
4089
+ if (c.fillStyle = `rgb(${i.backgroundColor.r},${i.backgroundColor.g},${i.backgroundColor.b})`, c.fillRect(0, 0, e, t), i.showGrid) {
4090
+ c.strokeStyle = D("var(--nice-border, #e0e0e0)", c.canvas), c.lineWidth = 0.5;
4091
+ const m = i.gridSpacing * i.scale, k = (e / 2 - i.centerX * i.scale) % m, C = (t / 2 + i.centerY * i.scale) % m;
4092
+ for (let h = k; h < e; h += m)
4093
+ c.beginPath(), c.moveTo(h, 0), c.lineTo(h, t), c.stroke();
4094
+ for (let h = C; h < t; h += m)
4095
+ c.beginPath(), c.moveTo(0, h), c.lineTo(e, h), c.stroke();
3740
4096
  }
3741
4097
  if (i.showAxes) {
3742
- const g = f(0, 0);
3743
- l.strokeStyle = I("var(--nice-text, #333)", l.canvas), l.lineWidth = 1, l.beginPath(), l.moveTo(0, g.y), l.lineTo(e, g.y), l.stroke(), l.beginPath(), l.moveTo(g.x, 0), l.lineTo(g.x, t), l.stroke();
4098
+ const m = f(0, 0);
4099
+ c.strokeStyle = D("var(--nice-text, #333)", c.canvas), c.lineWidth = 1, c.beginPath(), c.moveTo(0, m.y), c.lineTo(e, m.y), c.stroke(), c.beginPath(), c.moveTo(m.x, 0), c.lineTo(m.x, t), c.stroke();
3744
4100
  }
3745
- for (const g of a) {
3746
- if (!g.visible)
4101
+ for (const m of a) {
4102
+ if (!m.visible)
3747
4103
  continue;
3748
- const w = `rgb(${g.color.r},${g.color.g},${g.color.b})`, M = c.includes(g.id);
3749
- switch (g.type) {
4104
+ const k = `rgb(${m.color.r},${m.color.g},${m.color.b})`, C = l.includes(m.id);
4105
+ switch (m.type) {
3750
4106
  case "point": {
3751
- const h = f(g.x, g.y);
3752
- l.beginPath(), l.arc(h.x, h.y, M ? g.size + 2 : g.size, 0, 2 * Math.PI), l.fillStyle = M ? I("var(--nice-primary-hover, #1976d2)", l.canvas) : w, l.fill(), g.label && (l.fillStyle = I("var(--nice-text, #333)", l.canvas), l.font = "12px sans-serif", l.fillText(g.label, h.x + 8, h.y - 8));
4107
+ const h = f(m.x, m.y);
4108
+ c.beginPath(), c.arc(h.x, h.y, C ? m.size + 2 : m.size, 0, 2 * Math.PI), c.fillStyle = C ? D("var(--nice-primary-hover, #1976d2)", c.canvas) : k, c.fill(), m.label && (c.fillStyle = D("var(--nice-text, #333)", c.canvas), c.font = "12px sans-serif", c.fillText(m.label, h.x + 8, h.y - 8));
3753
4109
  break;
3754
4110
  }
3755
4111
  case "segment": {
3756
- const h = o.getPoint(g.point1Id), k = o.getPoint(g.point2Id);
3757
- if (h && k) {
3758
- const S = f(h.x, h.y), D = f(k.x, k.y);
3759
- l.strokeStyle = w, l.lineWidth = g.width, l.beginPath(), l.moveTo(S.x, S.y), l.lineTo(D.x, D.y), l.stroke();
4112
+ const h = o.getPoint(m.point1Id), P = o.getPoint(m.point2Id);
4113
+ if (h && P) {
4114
+ const S = f(h.x, h.y), L = f(P.x, P.y);
4115
+ c.strokeStyle = k, c.lineWidth = m.width, c.beginPath(), c.moveTo(S.x, S.y), c.lineTo(L.x, L.y), c.stroke();
3760
4116
  }
3761
4117
  break;
3762
4118
  }
3763
4119
  case "line": {
3764
- const h = o.getPoint(g.point1Id), k = o.getPoint(g.point2Id);
3765
- if (h && k) {
3766
- const S = k.x - h.x, D = k.y - h.y, _ = -1e3, K = 1e3, Z = f(h.x + _ * S, h.y + _ * D), Q = f(h.x + K * S, h.y + K * D);
3767
- l.strokeStyle = w, l.lineWidth = g.width, l.beginPath(), l.moveTo(Z.x, Z.y), l.lineTo(Q.x, Q.y), l.stroke();
4120
+ const h = o.getPoint(m.point1Id), P = o.getPoint(m.point2Id);
4121
+ if (h && P) {
4122
+ const S = P.x - h.x, L = P.y - h.y, _ = -1e3, Z = 1e3, J = f(h.x + _ * S, h.y + _ * L), Q = f(h.x + Z * S, h.y + Z * L);
4123
+ c.strokeStyle = k, c.lineWidth = m.width, c.beginPath(), c.moveTo(J.x, J.y), c.lineTo(Q.x, Q.y), c.stroke();
3768
4124
  }
3769
4125
  break;
3770
4126
  }
3771
4127
  case "circle": {
3772
- const h = o.getPoint(g.centerId);
4128
+ const h = o.getPoint(m.centerId);
3773
4129
  if (h) {
3774
- const k = f(h.x, h.y), S = g.radius * i.scale;
3775
- l.beginPath(), l.arc(k.x, k.y, S, 0, 2 * Math.PI), g.fill && (l.fillStyle = `rgba(${g.fill.r},${g.fill.g},${g.fill.b},${g.fill.a ?? 0.2})`, l.fill()), l.strokeStyle = w, l.lineWidth = g.width, l.stroke();
4130
+ const P = f(h.x, h.y), S = m.radius * i.scale;
4131
+ c.beginPath(), c.arc(P.x, P.y, S, 0, 2 * Math.PI), m.fill && (c.fillStyle = `rgba(${m.fill.r},${m.fill.g},${m.fill.b},${m.fill.a ?? 0.2})`, c.fill()), c.strokeStyle = k, c.lineWidth = m.width, c.stroke();
3776
4132
  }
3777
4133
  break;
3778
4134
  }
3779
4135
  case "polygon": {
3780
- const h = g.pointIds.map((k) => o.getPoint(k)).filter(Boolean);
4136
+ const h = m.pointIds.map((P) => o.getPoint(P)).filter(Boolean);
3781
4137
  if (h.length > 0) {
3782
- l.beginPath();
3783
- const k = f(h[0].x, h[0].y);
3784
- l.moveTo(k.x, k.y);
4138
+ c.beginPath();
4139
+ const P = f(h[0].x, h[0].y);
4140
+ c.moveTo(P.x, P.y);
3785
4141
  for (let S = 1; S < h.length; S++) {
3786
- const D = f(h[S].x, h[S].y);
3787
- l.lineTo(D.x, D.y);
4142
+ const L = f(h[S].x, h[S].y);
4143
+ c.lineTo(L.x, L.y);
3788
4144
  }
3789
- l.closePath(), g.fill && (l.fillStyle = `rgba(${g.fill.r},${g.fill.g},${g.fill.b},${g.fill.a ?? 0.2})`, l.fill()), l.strokeStyle = w, l.lineWidth = g.width, l.stroke();
4145
+ c.closePath(), m.fill && (c.fillStyle = `rgba(${m.fill.r},${m.fill.g},${m.fill.b},${m.fill.a ?? 0.2})`, c.fill()), c.strokeStyle = k, c.lineWidth = m.width, c.stroke();
3790
4146
  }
3791
4147
  break;
3792
4148
  }
3793
4149
  }
3794
4150
  }
3795
4151
  if (p.length > 0) {
3796
- l.fillStyle = I(
4152
+ c.fillStyle = D(
3797
4153
  "var(--nice-primary-tint-30, rgba(25, 118, 210, 0.3))",
3798
- l.canvas
4154
+ c.canvas
3799
4155
  );
3800
- for (const g of p) {
3801
- const w = o.getPoint(g);
3802
- if (w) {
3803
- const M = f(w.x, w.y);
3804
- l.beginPath(), l.arc(M.x, M.y, 12, 0, 2 * Math.PI), l.fill();
4156
+ for (const m of p) {
4157
+ const k = o.getPoint(m);
4158
+ if (k) {
4159
+ const C = f(k.x, k.y);
4160
+ c.beginPath(), c.arc(C.x, C.y, 12, 0, 2 * Math.PI), c.fill();
3805
4161
  }
3806
4162
  }
3807
4163
  }
3808
4164
  }
3809
- }, [a, i, e, t, c, p, o, f]), /* @__PURE__ */ d(
4165
+ }, [a, i, e, t, l, p, o, f]), /* @__PURE__ */ d(
3810
4166
  "canvas",
3811
4167
  {
3812
4168
  ref: r,
3813
4169
  width: e,
3814
4170
  height: t,
3815
4171
  style: q.canvas,
3816
- onClick: C
4172
+ onClick: y
3817
4173
  }
3818
4174
  );
3819
4175
  }
3820
- function Ye({
4176
+ function He({
3821
4177
  width: e,
3822
4178
  height: t
3823
4179
  }) {
3824
- const { tool: r, elements: o, view: a, service: n } = H(), [i, c] = P(null), u = {
3825
- select: "Select",
3826
- point: "Point",
3827
- line: "Line",
3828
- ray: "Ray",
3829
- segment: "Segment",
3830
- circle: "Circle",
3831
- arc: "Arc",
3832
- polygon: "Polygon",
3833
- angle: "Angle",
3834
- perpendicular: "Perpendicular",
3835
- parallel: "Parallel",
3836
- bisector: "Angle Bisector",
3837
- midpoint: "Midpoint",
3838
- tangent: "Tangent",
3839
- intersection: "Intersection",
3840
- reflect: "Reflect",
3841
- rotate: "Rotate",
3842
- translate: "Translate",
3843
- dilate: "Dilate",
3844
- measure: "Measure",
3845
- text: "Text"
3846
- }, s = o.filter((p) => p.type === "point").length;
4180
+ const { t: r } = E(), { tool: o, elements: a, view: n, service: i } = H(), [l, g] = M(null), s = {
4181
+ select: r("geometry.select", "Select"),
4182
+ point: r("geometry.point", "Point"),
4183
+ line: r("geometry.line", "Line"),
4184
+ ray: r("geometry.ray", "Ray"),
4185
+ segment: r("geometry.segment", "Segment"),
4186
+ circle: r("geometry.circle", "Circle"),
4187
+ arc: r("geometry.arc", "Arc"),
4188
+ polygon: r("geometry.polygon", "Polygon"),
4189
+ angle: r("geometry.angle", "Angle"),
4190
+ perpendicular: r("geometry.perpendicular", "Perpendicular"),
4191
+ parallel: r("geometry.parallel", "Parallel"),
4192
+ bisector: r("geometry.angleBisector", "Angle Bisector"),
4193
+ midpoint: r("geometry.midpoint", "Midpoint"),
4194
+ tangent: r("geometry.tangent", "Tangent"),
4195
+ intersection: r("geometry.intersection", "Intersection"),
4196
+ reflect: r("geometry.reflect", "Reflect"),
4197
+ rotate: r("geometry.rotate", "Rotate"),
4198
+ translate: r("geometry.translate", "Translate"),
4199
+ dilate: r("geometry.dilate", "Dilate"),
4200
+ measure: r("geometry.measure", "Measure"),
4201
+ text: r("geometry.text", "Text")
4202
+ }, p = a.filter((u) => u.type === "point").length;
3847
4203
  return /* @__PURE__ */ v("div", { style: q.statusBar, children: [
3848
- /* @__PURE__ */ v("span", { children: [
3849
- "Tool: ",
3850
- u[r]
3851
- ] }),
4204
+ /* @__PURE__ */ d("span", { children: r("geometry.tool", "Tool: {tool}").replace("{tool}", String(s[o])) }),
3852
4205
  /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
3853
- /* @__PURE__ */ v("span", { children: [
3854
- "Objects: ",
3855
- o.length
3856
- ] }),
4206
+ /* @__PURE__ */ d("span", { children: r("geometry.objects", "Objects: {elements}").replace(
4207
+ "{elements}",
4208
+ String(a.length)
4209
+ ) }),
3857
4210
  /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
3858
- /* @__PURE__ */ v("span", { children: [
3859
- "Points: ",
3860
- s
3861
- ] }),
4211
+ /* @__PURE__ */ d("span", { children: r("geometry.points", "Points: {pointCount}").replace("{pointCount}", String(p)) }),
3862
4212
  /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
3863
- /* @__PURE__ */ v("span", { children: [
3864
- "Scale: ",
3865
- a.scale.toFixed(1),
3866
- "x"
3867
- ] })
4213
+ /* @__PURE__ */ d("span", { children: r("geometry.scaleX", "Scale: {scale}x").replace("{scale}", String(n.scale.toFixed(1))) })
3868
4214
  ] });
3869
4215
  }
3870
4216
  export {
3871
- Le as CalculatorService,
4217
+ Xe as CalculatorService,
3872
4218
  te as CalculusOps,
3873
- we as EQUATION_TEMPLATES,
3874
- ie as ExpressionParser,
4219
+ Me as EQUATION_TEMPLATES,
4220
+ le as ExpressionParser,
3875
4221
  ee as FUNCTION_PRESETS,
3876
- E as GeoMath,
3877
- Oe as GeometryService,
3878
- Te as GraphService,
3879
- be as MATH_SYMBOLS,
3880
- ke as MathEditorService,
3881
- z as MatrixOps,
3882
- at as NiceCalculator,
3883
- it as NiceGeometry,
3884
- rt as NiceGraphPlotter,
3885
- Qe as NiceI18nProvider,
3886
- et as NiceMathEditor,
3887
- ot as createCalculatorService,
3888
- nt as createGeometryService,
3889
- tt as createGraphService,
3890
- Je as createMathEditorService,
3891
- ve as getSymbolsByCategory,
3892
- Ce as recognizeHandwriting,
3893
- N as useCalculator,
4222
+ I as GeoMath,
4223
+ Ke as GeometryService,
4224
+ Ie as GraphService,
4225
+ ke as MATH_SYMBOLS,
4226
+ Ce as MathEditorService,
4227
+ $ as MatrixOps,
4228
+ st as NiceCalculator,
4229
+ ct as NiceGeometry,
4230
+ nt as NiceGraphPlotter,
4231
+ tt as NiceI18nProvider,
4232
+ ot as NiceMathEditor,
4233
+ it as createCalculatorService,
4234
+ lt as createGeometryService,
4235
+ at as createGraphService,
4236
+ rt as createMathEditorService,
4237
+ Pe as getSymbolsByCategory,
4238
+ Se as recognizeHandwriting,
4239
+ X as useCalculator,
3894
4240
  H as useGeometry,
3895
- Y as useGraph,
4241
+ K as useGraph,
3896
4242
  W as useMathEditor,
3897
- L as useNiceTranslation
4243
+ E as useNiceTranslation
3898
4244
  };