@nice2dev/ui-math 1.2.1 → 1.2.2

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, resolveCssColor as D, NiceIcon as j } from "@nice2dev/ui-core";
7
+ import be, { 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 K = {
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 = { ...K.en, ...K[e], ...t };
543
+ return { locale: e, t: (a, n) => r[a] ?? n ?? a };
544
+ }
545
+ function et({ locale: e = "en", overrides: t, children: r }) {
546
+ const o = ae(() => ie(e, t), [e, t]);
547
+ return be.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 = K[t] ? t : "en", o = ae(() => ie(r), [r]);
551
+ return e ?? o;
220
552
  }
221
- const fe = [
553
+ const ve = [
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
+ ], we = [
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 ke(e) {
740
+ return we.filter((t) => t.category === e);
409
741
  }
410
- const we = [
742
+ const Pe = [
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 Me {
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,8 +880,8 @@ 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 tt(e) {
884
+ return new Me(e);
553
885
  }
554
886
  async function Ce(e) {
555
887
  return await new Promise((r) => setTimeout(r, 500)), {
@@ -558,9 +890,9 @@ async function Ce(e) {
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 rt({
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(Se, {}),
1030
+ sidebar: /* @__PURE__ */ d(Be, {}),
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, ve) }) }),
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(Te, { latex: l })
1045
+ ] }) : /* @__PURE__ */ d(Re, {}) })
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 Se() {
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,13 @@ 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
+ Pe.filter((g) => g.category === l).map((g) => /* @__PURE__ */ v(
792
1124
  "div",
793
1125
  {
794
1126
  onClick: () => {
795
- a(u), i(!1);
1127
+ a(g), i(!1);
796
1128
  },
797
1129
  style: {
798
1130
  padding: "8px 12px",
@@ -802,7 +1134,7 @@ function Pe() {
802
1134
  onMouseOver: (s) => s.target.style.backgroundColor = "var(--nice-bg-secondary, #f5f5f5)",
803
1135
  onMouseOut: (s) => s.target.style.backgroundColor = "transparent",
804
1136
  children: [
805
- /* @__PURE__ */ d("div", { style: { fontWeight: 500 }, children: u.name }),
1137
+ /* @__PURE__ */ d("div", { style: { fontWeight: 500 }, children: g.name }),
806
1138
  /* @__PURE__ */ v(
807
1139
  "div",
808
1140
  {
@@ -812,16 +1144,16 @@ function Pe() {
812
1144
  fontFamily: "monospace"
813
1145
  },
814
1146
  children: [
815
- u.latex.substring(0, 40),
816
- u.latex.length > 40 ? "..." : ""
1147
+ g.latex.substring(0, 40),
1148
+ g.latex.length > 40 ? "..." : ""
817
1149
  ]
818
1150
  }
819
1151
  )
820
1152
  ]
821
1153
  },
822
- u.name
1154
+ g.name
823
1155
  ))
824
- ] }, c)
1156
+ ] }, l)
825
1157
  )
826
1158
  }
827
1159
  )
@@ -833,7 +1165,7 @@ function Pe() {
833
1165
  onClick: () => navigator.clipboard.writeText(o),
834
1166
  style: { ...A.button, backgroundColor: "var(--nice-success, #4caf50)" },
835
1167
  children: [
836
- /* @__PURE__ */ d(X, { name: "copy", size: 14 }),
1168
+ /* @__PURE__ */ d(N, { name: "copy", size: 14 }),
837
1169
  " ",
838
1170
  e("editor.copyLatex", "Copy LaTeX")
839
1171
  ]
@@ -841,8 +1173,8 @@ function Pe() {
841
1173
  )
842
1174
  ] });
843
1175
  }
844
- function Me() {
845
- const { insertSymbol: e } = W(), [t, r] = P("greek"), o = [
1176
+ function Be() {
1177
+ const { insertSymbol: e } = W(), [t, r] = M("greek"), o = [
846
1178
  "greek",
847
1179
  "operators",
848
1180
  "relations",
@@ -854,7 +1186,7 @@ function Me() {
854
1186
  "logic",
855
1187
  "calculus",
856
1188
  "matrices"
857
- ], a = ve(t);
1189
+ ], a = ke(t);
858
1190
  return /* @__PURE__ */ v("div", { style: A.sidebar, children: [
859
1191
  /* @__PURE__ */ d("div", { style: { display: "flex", flexWrap: "wrap", padding: "8px", gap: "4px" }, children: o.map((n) => /* @__PURE__ */ d(
860
1192
  "button",
@@ -885,94 +1217,98 @@ function Me() {
885
1217
  )) })
886
1218
  ] });
887
1219
  }
888
- function Se({ latex: e }) {
1220
+ function Te({ latex: e }) {
1221
+ const { t } = E();
889
1222
  return /* @__PURE__ */ v("div", { style: A.preview, children: [
890
1223
  /* @__PURE__ */ d(
891
1224
  "div",
892
1225
  {
893
1226
  style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)", marginBottom: "8px" },
894
- children: "Preview (requires KaTeX/MathJax integration):"
1227
+ children: t(
1228
+ "editor.previewRequiresKatexMathjaxIntegration",
1229
+ "Preview (requires KaTeX/MathJax integration):"
1230
+ )
895
1231
  }
896
1232
  ),
897
1233
  /* @__PURE__ */ d("code", { style: { fontSize: "16px" }, children: e || "(empty)" })
898
1234
  ] });
899
1235
  }
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)
1236
+ function Re() {
1237
+ 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) => {
1238
+ const m = o.current;
1239
+ if (!m)
904
1240
  return;
905
1241
  s(!0);
906
- const w = g.getBoundingClientRect();
907
- c([
1242
+ const k = m.getBoundingClientRect();
1243
+ l([
908
1244
  {
909
- x: l.clientX - w.left,
910
- y: l.clientY - w.top,
911
- pressure: l.pressure,
1245
+ x: c.clientX - k.left,
1246
+ y: c.clientY - k.top,
1247
+ pressure: c.pressure,
912
1248
  timestamp: Date.now()
913
1249
  }
914
1250
  ]);
915
- }, f = (l) => {
916
- if (!u)
1251
+ }, f = (c) => {
1252
+ if (!g)
917
1253
  return;
918
- const g = o.current, w = g == null ? void 0 : g.getContext("2d");
919
- if (!g || !w)
1254
+ const m = o.current, k = m == null ? void 0 : m.getContext("2d");
1255
+ if (!m || !k)
920
1256
  return;
921
- const M = g.getBoundingClientRect(), h = {
922
- x: l.clientX - M.left,
923
- y: l.clientY - M.top,
924
- pressure: l.pressure,
1257
+ const C = m.getBoundingClientRect(), h = {
1258
+ x: c.clientX - C.left,
1259
+ y: c.clientY - C.top,
1260
+ pressure: c.pressure,
925
1261
  timestamp: Date.now()
926
1262
  };
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();
1263
+ if (l((P) => [...P, h]), i.length > 0) {
1264
+ const P = i[i.length - 1];
1265
+ 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
1266
  }
931
- }, C = () => {
932
- if (u) {
1267
+ }, w = () => {
1268
+ if (g) {
933
1269
  if (s(!1), i.length > 1) {
934
- const l = {
1270
+ const c = {
935
1271
  id: Date.now().toString(),
936
1272
  points: [...i]
937
1273
  };
938
- n((g) => [...g, l]);
1274
+ n((m) => [...m, c]);
939
1275
  }
940
- c([]);
1276
+ l([]);
941
1277
  }
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([]);
1278
+ }, y = () => {
1279
+ const c = o.current, m = c == null ? void 0 : c.getContext("2d");
1280
+ m && c && m.clearRect(0, 0, c.width, c.height), n([]);
945
1281
  }, b = async () => {
946
1282
  if (a.length !== 0) {
947
- m(!0);
1283
+ u(!0);
948
1284
  try {
949
- const l = await Ce(a);
950
- t(l.latex), r("input");
1285
+ const c = await Ce(a);
1286
+ t(c.latex), r("input");
951
1287
  } finally {
952
- m(!1);
1288
+ u(!1);
953
1289
  }
954
1290
  }
955
1291
  };
956
- return V(() => {
957
- const l = o.current;
958
- l && (l.width = l.offsetWidth, l.height = 200);
1292
+ return Y(() => {
1293
+ const c = o.current;
1294
+ c && (c.width = c.offsetWidth, c.height = 200);
959
1295
  }, []), /* @__PURE__ */ v("div", { children: [
960
1296
  /* @__PURE__ */ d(
961
1297
  "canvas",
962
1298
  {
963
1299
  ref: o,
964
1300
  style: A.canvas,
965
- onPointerDown: y,
1301
+ onPointerDown: x,
966
1302
  onPointerMove: f,
967
- onPointerUp: C,
968
- onPointerLeave: C
1303
+ onPointerUp: w,
1304
+ onPointerLeave: w
969
1305
  }
970
1306
  ),
971
1307
  /* @__PURE__ */ v("div", { style: { display: "flex", gap: "8px", marginTop: "12px" }, children: [
972
1308
  /* @__PURE__ */ d(
973
1309
  "button",
974
1310
  {
975
- onClick: x,
1311
+ onClick: y,
976
1312
  style: { ...A.button, backgroundColor: "var(--nice-danger, #f44336)" },
977
1313
  children: e("editor.clear", "Clear")
978
1314
  }
@@ -993,14 +1329,14 @@ function Be() {
993
1329
  ) })
994
1330
  ] });
995
1331
  }
996
- const $e = {
1332
+ const ze = {
997
1333
  pi: Math.PI,
998
1334
  PI: Math.PI,
999
1335
  e: Math.E,
1000
1336
  E: Math.E,
1001
1337
  phi: (1 + Math.sqrt(5)) / 2,
1002
1338
  tau: Math.PI * 2
1003
- }, Re = {
1339
+ }, Ae = {
1004
1340
  sin: Math.sin,
1005
1341
  cos: Math.cos,
1006
1342
  tan: Math.tan,
@@ -1032,11 +1368,11 @@ const $e = {
1032
1368
  cot: (e) => 1 / Math.tan(e),
1033
1369
  ln: Math.log
1034
1370
  };
1035
- class ie {
1371
+ class le {
1036
1372
  constructor(t = {}) {
1037
- T(this, "pos", 0);
1038
- T(this, "expr", "");
1039
- T(this, "options");
1373
+ z(this, "pos", 0);
1374
+ z(this, "expr", "");
1375
+ z(this, "options");
1040
1376
  this.options = t;
1041
1377
  }
1042
1378
  parse(t) {
@@ -1132,7 +1468,7 @@ class ie {
1132
1468
  case "variable": {
1133
1469
  if (t.name in r)
1134
1470
  return r[t.name];
1135
- const o = this.lookup({ ...$e, ...this.options.constants }, t.name);
1471
+ const o = this.lookup({ ...ze, ...this.options.constants }, t.name);
1136
1472
  if (o !== void 0)
1137
1473
  return o;
1138
1474
  throw new Error(`Unknown variable: ${t.name}`);
@@ -1157,7 +1493,7 @@ class ie {
1157
1493
  }
1158
1494
  }
1159
1495
  case "call": {
1160
- const o = this.lookup({ ...Re, ...this.options.functions }, t.name);
1496
+ const o = this.lookup({ ...Ae, ...this.options.functions }, t.name);
1161
1497
  if (!o)
1162
1498
  throw new Error(`Unknown function: ${t.name}`);
1163
1499
  const a = t.args.map((n) => this.evaluate(n, r));
@@ -1168,11 +1504,11 @@ class ie {
1168
1504
  }
1169
1505
  }
1170
1506
  }
1171
- class Te {
1507
+ class $e {
1172
1508
  constructor(t = {}) {
1173
- T(this, "plots", /* @__PURE__ */ new Map());
1174
- T(this, "parser", new ie());
1175
- T(this, "config");
1509
+ z(this, "plots", /* @__PURE__ */ new Map());
1510
+ z(this, "parser", new le());
1511
+ z(this, "config");
1176
1512
  this.config = {
1177
1513
  defaultResolution: t.defaultResolution ?? 200,
1178
1514
  maxResolution: t.maxResolution ?? 1e3
@@ -1218,9 +1554,9 @@ class Te {
1218
1554
  }
1219
1555
  /** Compute 2D function points */
1220
1556
  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;
1557
+ const n = this.parser.parse(t), i = [], l = (r.max - r.min) / o;
1558
+ for (let g = 0; g <= o; g++) {
1559
+ const s = r.min + g * l;
1224
1560
  try {
1225
1561
  const p = n({ x: s, ...a });
1226
1562
  Number.isFinite(p) && i.push({ x: s, y: p });
@@ -1231,27 +1567,27 @@ class Te {
1231
1567
  }
1232
1568
  /** Compute 2D parametric curve */
1233
1569
  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;
1570
+ const i = this.parser.parse(t), l = this.parser.parse(r), g = [], s = (o.max - o.min) / a;
1235
1571
  for (let p = 0; p <= a; p++) {
1236
- const m = o.min + p * s;
1572
+ const u = o.min + p * s;
1237
1573
  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 });
1574
+ const x = i({ t: u, ...n }), f = l({ t: u, ...n });
1575
+ Number.isFinite(x) && Number.isFinite(f) && g.push({ x, y: f });
1240
1576
  } catch {
1241
1577
  }
1242
1578
  }
1243
- return u;
1579
+ return g;
1244
1580
  }
1245
1581
  /** Compute 2D polar curve */
1246
1582
  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;
1583
+ const n = this.parser.parse(t), i = [], l = (r.max - r.min) / o;
1584
+ for (let g = 0; g <= o; g++) {
1585
+ const s = r.min + g * l;
1250
1586
  try {
1251
1587
  const p = n({ theta: s, t: s, ...a });
1252
1588
  if (Number.isFinite(p)) {
1253
- const m = p * Math.cos(s), y = p * Math.sin(s);
1254
- i.push({ x: m, y });
1589
+ const u = p * Math.cos(s), x = p * Math.sin(s);
1590
+ i.push({ x: u, y: x });
1255
1591
  }
1256
1592
  } catch {
1257
1593
  }
@@ -1260,52 +1596,52 @@ class Te {
1260
1596
  }
1261
1597
  /** Compute 3D surface points */
1262
1598
  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;
1599
+ const i = this.parser.parse(t), l = [], g = (r.max - r.min) / a, s = (o.max - o.min) / a;
1264
1600
  for (let p = 0; p <= a; p++) {
1265
- const m = [], y = r.min + p * u;
1601
+ const u = [], x = r.min + p * g;
1266
1602
  for (let f = 0; f <= a; f++) {
1267
- const C = o.min + f * s;
1603
+ const w = o.min + f * s;
1268
1604
  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 });
1605
+ const y = i({ x, y: w, ...n });
1606
+ Number.isFinite(y) ? u.push({ x, y: w, z: y }) : u.push({ x, y: w, z: 0 });
1271
1607
  } catch {
1272
- m.push({ x: y, y: C, z: 0 });
1608
+ u.push({ x, y: w, z: 0 });
1273
1609
  }
1274
1610
  }
1275
- c.push(m);
1611
+ l.push(u);
1276
1612
  }
1277
- return c;
1613
+ return l;
1278
1614
  }
1279
1615
  /** Export plot data as SVG */
1280
1616
  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 = [
1617
+ 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
1618
  `<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${a}">`,
1283
1619
  `<rect width="100%" height="100%" fill="rgb(${r.backgroundColor.r},${r.backgroundColor.g},${r.backgroundColor.b})"/>`
1284
1620
  ];
1285
1621
  if (r.showGrid) {
1286
1622
  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}"/>`);
1623
+ for (let u = Math.ceil(r.xRange.min); u <= r.xRange.max; u++) {
1624
+ const x = g(u);
1625
+ p.push(`<line x1="${x}" y1="40" x2="${x}" y2="${a - 40}"/>`);
1290
1626
  }
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}"/>`);
1627
+ for (let u = Math.ceil(r.yRange.min); u <= r.yRange.max; u++) {
1628
+ const x = s(u);
1629
+ p.push(`<line x1="40" y1="${x}" x2="${o - 40}" y2="${x}"/>`);
1294
1630
  }
1295
1631
  p.push("</g>");
1296
1632
  }
1297
1633
  if (r.showAxes) {
1298
1634
  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>");
1635
+ const u = s(0), x = g(0);
1636
+ 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
1637
  }
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(" ");
1638
+ for (const u of t.filter((x) => x.visible))
1639
+ if (u.type === "2d-function") {
1640
+ const x = this.compute2DFunction(u.expression, r.xRange, u.resolution || 200);
1641
+ if (x.length > 0) {
1642
+ const f = x.map((w, y) => `${y === 0 ? "M" : "L"}${g(w.x)},${s(w.y)}`).join(" ");
1307
1643
  p.push(
1308
- `<path d="${f}" fill="none" stroke="rgb(${m.color.r},${m.color.g},${m.color.b})" stroke-width="${m.lineWidth}"/>`
1644
+ `<path d="${f}" fill="none" stroke="rgb(${u.color.r},${u.color.g},${u.color.b})" stroke-width="${u.lineWidth}"/>`
1309
1645
  );
1310
1646
  }
1311
1647
  }
@@ -1319,26 +1655,26 @@ class Te {
1319
1655
  /** Export as PNG (data URL) */
1320
1656
  async exportPNG(t, r, o, a) {
1321
1657
  const n = this.exportSVG(t, r, o, a);
1322
- return new Promise((i, c) => {
1323
- const u = new Image();
1324
- u.onload = () => {
1658
+ return new Promise((i, l) => {
1659
+ const g = new Image();
1660
+ g.onload = () => {
1325
1661
  const s = document.createElement("canvas");
1326
1662
  s.width = o, s.height = a;
1327
1663
  const p = s.getContext("2d");
1328
1664
  if (!p) {
1329
- c(new Error("Could not get canvas context"));
1665
+ l(new Error("Could not get canvas context"));
1330
1666
  return;
1331
1667
  }
1332
- p.drawImage(u, 0, 0), i(s.toDataURL("image/png"));
1333
- }, u.onerror = c, u.src = "data:image/svg+xml;base64," + btoa(n);
1668
+ p.drawImage(g, 0, 0), i(s.toDataURL("image/png"));
1669
+ }, g.onerror = l, g.src = "data:image/svg+xml;base64," + btoa(n);
1334
1670
  });
1335
1671
  }
1336
1672
  generateId() {
1337
1673
  return Date.now().toString(36) + Math.random().toString(36).substring(2, 8);
1338
1674
  }
1339
1675
  }
1340
- function tt(e) {
1341
- return new Te(e);
1676
+ function ot(e) {
1677
+ return new $e(e);
1342
1678
  }
1343
1679
  const ee = [
1344
1680
  // Basic
@@ -1423,14 +1759,14 @@ const ee = [
1423
1759
  type: "3d-surface",
1424
1760
  category: "3d"
1425
1761
  }
1426
- ], se = /* @__PURE__ */ F(null);
1427
- function Y() {
1428
- const e = j(se);
1762
+ ], ce = /* @__PURE__ */ O(null);
1763
+ function V() {
1764
+ const e = F(ce);
1429
1765
  if (!e)
1430
1766
  throw new Error("useGraph must be used within GraphProvider");
1431
1767
  return e;
1432
1768
  }
1433
- const $ = {
1769
+ const T = {
1434
1770
  container: {
1435
1771
  display: "flex",
1436
1772
  height: "100%",
@@ -1489,14 +1825,14 @@ const $ = {
1489
1825
  backgroundColor: "var(--nice-bg-secondary, #fafafa)"
1490
1826
  }
1491
1827
  };
1492
- function rt({
1828
+ function at({
1493
1829
  service: e,
1494
1830
  width: t = 800,
1495
1831
  height: r = 600,
1496
1832
  className: o,
1497
1833
  style: a
1498
1834
  }) {
1499
- const [n, i] = P([]), [c, u] = P({
1835
+ const [n, i] = M([]), [l, g] = M({
1500
1836
  xRange: { min: -10, max: 10 },
1501
1837
  yRange: { min: -10, max: 10 },
1502
1838
  zRange: { min: -5, max: 5 },
@@ -1507,59 +1843,59 @@ function rt({
1507
1843
  cameraRotationX: 30,
1508
1844
  cameraRotationY: 45,
1509
1845
  cameraDistance: 5
1510
- }), [s, p] = P({
1846
+ }), [s, p] = M({
1511
1847
  isPlaying: !1,
1512
1848
  parameter: "a",
1513
1849
  currentValue: 0,
1514
1850
  minValue: -5,
1515
1851
  maxValue: 5,
1516
1852
  speed: 1
1517
- }), m = R(() => {
1853
+ }), u = R(() => {
1518
1854
  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();
1855
+ }, [e]), x = R((m) => {
1856
+ g((k) => ({ ...k, ...m }));
1857
+ }, []), f = R((m) => {
1858
+ p((k) => ({ ...k, ...m }));
1859
+ }, []), w = R(
1860
+ (m) => {
1861
+ e.addPlot(m), u();
1526
1862
  },
1527
- [e, m]
1528
- ), x = R(
1529
- (g) => {
1530
- e.removePlot(g), m();
1863
+ [e, u]
1864
+ ), y = R(
1865
+ (m) => {
1866
+ e.removePlot(m), u();
1531
1867
  },
1532
- [e, m]
1868
+ [e, u]
1533
1869
  ), b = R(
1534
- (g, w) => {
1535
- e.updatePlot(g, w), m();
1870
+ (m, k) => {
1871
+ e.updatePlot(m, k), u();
1536
1872
  },
1537
- [e, m]
1538
- ), l = {
1873
+ [e, u]
1874
+ ), c = {
1539
1875
  service: e,
1540
1876
  plots: n,
1541
- view: c,
1542
- setView: y,
1543
- addPlot: C,
1544
- removePlot: x,
1877
+ view: l,
1878
+ setView: x,
1879
+ addPlot: w,
1880
+ removePlot: y,
1545
1881
  updatePlot: b,
1546
1882
  animation: s,
1547
1883
  setAnimation: f,
1548
- refresh: m
1884
+ refresh: u
1549
1885
  };
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, {})
1886
+ return /* @__PURE__ */ d(ce.Provider, { value: c, children: /* @__PURE__ */ v("div", { className: o, style: { ...T.container, ...a }, children: [
1887
+ /* @__PURE__ */ v("div", { style: T.sidebar, children: [
1888
+ /* @__PURE__ */ d(Ie, {}),
1889
+ /* @__PURE__ */ d(Ee, {})
1554
1890
  ] }),
1555
- /* @__PURE__ */ v("div", { style: $.main, children: [
1556
- /* @__PURE__ */ d(Ee, { width: t, height: r }),
1557
- /* @__PURE__ */ d(Ie, { width: t, height: r })
1891
+ /* @__PURE__ */ v("div", { style: T.main, children: [
1892
+ /* @__PURE__ */ d(De, { width: t, height: r }),
1893
+ /* @__PURE__ */ d(Le, { width: t, height: r })
1558
1894
  ] })
1559
1895
  ] }) });
1560
1896
  }
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 = () => {
1897
+ function Ie() {
1898
+ const { t: e } = E(), { addPlot: t } = V(), [r, o] = M("sin(x)"), [a, n] = M("2d-function"), [i, l] = M("cos(x)"), g = () => {
1563
1899
  t({
1564
1900
  type: a,
1565
1901
  expression: r,
@@ -1577,12 +1913,12 @@ function Ae() {
1577
1913
  {
1578
1914
  value: a,
1579
1915
  onChange: (s) => n(s.target.value),
1580
- style: { ...$.input, width: "100%" },
1916
+ style: { ...T.input, width: "100%" },
1581
1917
  children: [
1582
1918
  /* @__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)" })
1919
+ /* @__PURE__ */ d("option", { value: "2d-parametric", children: e("plotter.parametricXTYT", "Parametric (x(t), y(t))") }),
1920
+ /* @__PURE__ */ d("option", { value: "2d-polar", children: e("plotter.polarRF", "Polar r = f(θ)") }),
1921
+ /* @__PURE__ */ d("option", { value: "3d-surface", children: e("plotter.n3dSurfaceZFX", "3D Surface z = f(x,y)") })
1586
1922
  ]
1587
1923
  }
1588
1924
  ) }),
@@ -1592,8 +1928,8 @@ function Ae() {
1592
1928
  type: "text",
1593
1929
  value: r,
1594
1930
  onChange: (s) => o(s.target.value),
1595
- placeholder: a === "2d-parametric" ? "x(t) = ..." : "Expression...",
1596
- style: { ...$.input, width: "100%" }
1931
+ placeholder: a === "2d-parametric" ? "x(t) = ..." : e("plotter.expression", "Expression..."),
1932
+ style: { ...T.input, width: "100%" }
1597
1933
  }
1598
1934
  ) }),
1599
1935
  a === "2d-parametric" && /* @__PURE__ */ d("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ d(
@@ -1601,17 +1937,17 @@ function Ae() {
1601
1937
  {
1602
1938
  type: "text",
1603
1939
  value: i,
1604
- onChange: (s) => c(s.target.value),
1940
+ onChange: (s) => l(s.target.value),
1605
1941
  placeholder: "y(t) = ...",
1606
- style: { ...$.input, width: "100%" }
1942
+ style: { ...T.input, width: "100%" }
1607
1943
  }
1608
1944
  ) }),
1609
- /* @__PURE__ */ d("button", { onClick: u, style: { ...$.button, width: "100%" }, children: "+ Add Plot" }),
1945
+ /* @__PURE__ */ d("button", { onClick: g, style: { ...T.button, width: "100%" }, children: e("plotter.addPlot", "+ Add Plot") }),
1610
1946
  /* @__PURE__ */ v(
1611
1947
  "select",
1612
1948
  {
1613
1949
  onChange: (s) => {
1614
- const p = ee.find((m) => m.name === s.target.value);
1950
+ const p = ee.find((u) => u.name === s.target.value);
1615
1951
  p && t({
1616
1952
  type: p.type,
1617
1953
  expression: p.expression,
@@ -1624,7 +1960,7 @@ function Ae() {
1624
1960
  }
1625
1961
  });
1626
1962
  },
1627
- style: { ...$.input, width: "100%", marginTop: "8px" },
1963
+ style: { ...T.input, width: "100%", marginTop: "8px" },
1628
1964
  value: "",
1629
1965
  children: [
1630
1966
  /* @__PURE__ */ d("option", { value: "", disabled: !0, children: e("plotter.quickAdd", "Quick add preset...") }),
@@ -1638,9 +1974,9 @@ function Ae() {
1638
1974
  )
1639
1975
  ] });
1640
1976
  }
1641
- function ze() {
1642
- const { t: e } = L(), { plots: t, removePlot: r, updatePlot: o } = Y();
1643
- return /* @__PURE__ */ v("div", { style: $.plotList, children: [
1977
+ function Ee() {
1978
+ const { t: e } = E(), { plots: t, removePlot: r, updatePlot: o } = V();
1979
+ return /* @__PURE__ */ v("div", { style: T.plotList, children: [
1644
1980
  t.length === 0 && /* @__PURE__ */ d(
1645
1981
  "div",
1646
1982
  {
@@ -1652,7 +1988,7 @@ function ze() {
1652
1988
  children: e("plotter.noPlots", "No plots added yet")
1653
1989
  }
1654
1990
  ),
1655
- t.map((a) => /* @__PURE__ */ v("div", { style: $.plotItem, children: [
1991
+ t.map((a) => /* @__PURE__ */ v("div", { style: T.plotItem, children: [
1656
1992
  /* @__PURE__ */ v("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginBottom: "8px" }, children: [
1657
1993
  /* @__PURE__ */ d(
1658
1994
  "input",
@@ -1688,7 +2024,7 @@ function ze() {
1688
2024
  cursor: "pointer",
1689
2025
  fontSize: "12px"
1690
2026
  },
1691
- children: /* @__PURE__ */ d(G, { name: "close", size: 14 })
2027
+ children: /* @__PURE__ */ d(j, { name: "close", size: 14 })
1692
2028
  }
1693
2029
  )
1694
2030
  ] }),
@@ -1712,15 +2048,15 @@ function ze() {
1712
2048
  ] }, a.id))
1713
2049
  ] });
1714
2050
  }
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 () => {
2051
+ function De({ width: e, height: t }) {
2052
+ const { t: r } = E(), { service: o, plots: a, view: n, setView: i } = V(), l = () => {
2053
+ const s = o.exportSVG(a, n, e, t), p = new Blob([s], { type: "image/svg+xml" }), u = URL.createObjectURL(p), x = document.createElement("a");
2054
+ x.href = u, x.download = "graph.svg", x.click(), URL.revokeObjectURL(u);
2055
+ }, g = async () => {
1720
2056
  const s = await o.exportPNG(a, n, e, t), p = document.createElement("a");
1721
2057
  p.href = s, p.download = "graph.png", p.click();
1722
2058
  };
1723
- return /* @__PURE__ */ v("div", { style: $.toolbar, children: [
2059
+ return /* @__PURE__ */ v("div", { style: T.toolbar, children: [
1724
2060
  /* @__PURE__ */ v("label", { style: { fontSize: "12px" }, children: [
1725
2061
  "X: [",
1726
2062
  " ",
@@ -1730,7 +2066,7 @@ function Ee({ width: e, height: t }) {
1730
2066
  type: "number",
1731
2067
  value: n.xRange.min,
1732
2068
  onChange: (s) => i({ xRange: { ...n.xRange, min: Number(s.target.value) } }),
1733
- style: { ...$.input, width: "50px" }
2069
+ style: { ...T.input, width: "50px" }
1734
2070
  }
1735
2071
  ),
1736
2072
  ",",
@@ -1741,7 +2077,7 @@ function Ee({ width: e, height: t }) {
1741
2077
  type: "number",
1742
2078
  value: n.xRange.max,
1743
2079
  onChange: (s) => i({ xRange: { ...n.xRange, max: Number(s.target.value) } }),
1744
- style: { ...$.input, width: "50px" }
2080
+ style: { ...T.input, width: "50px" }
1745
2081
  }
1746
2082
  ),
1747
2083
  "]"
@@ -1755,7 +2091,7 @@ function Ee({ width: e, height: t }) {
1755
2091
  type: "number",
1756
2092
  value: n.yRange.min,
1757
2093
  onChange: (s) => i({ yRange: { ...n.yRange, min: Number(s.target.value) } }),
1758
- style: { ...$.input, width: "50px" }
2094
+ style: { ...T.input, width: "50px" }
1759
2095
  }
1760
2096
  ),
1761
2097
  ",",
@@ -1766,7 +2102,7 @@ function Ee({ width: e, height: t }) {
1766
2102
  type: "number",
1767
2103
  value: n.yRange.max,
1768
2104
  onChange: (s) => i({ yRange: { ...n.yRange, max: Number(s.target.value) } }),
1769
- style: { ...$.input, width: "50px" }
2105
+ style: { ...T.input, width: "50px" }
1770
2106
  }
1771
2107
  ),
1772
2108
  "]"
@@ -1797,10 +2133,10 @@ function Ee({ width: e, height: t }) {
1797
2133
  /* @__PURE__ */ v(
1798
2134
  "button",
1799
2135
  {
1800
- onClick: c,
1801
- style: { ...$.button, backgroundColor: "var(--nice-success, #4caf50)" },
2136
+ onClick: l,
2137
+ style: { ...T.button, backgroundColor: "var(--nice-success, #4caf50)" },
1802
2138
  children: [
1803
- /* @__PURE__ */ d(G, { name: "download", size: 14 }),
2139
+ /* @__PURE__ */ d(j, { name: "download", size: 14 }),
1804
2140
  " SVG"
1805
2141
  ]
1806
2142
  }
@@ -1808,97 +2144,97 @@ function Ee({ width: e, height: t }) {
1808
2144
  /* @__PURE__ */ v(
1809
2145
  "button",
1810
2146
  {
1811
- onClick: u,
1812
- style: { ...$.button, backgroundColor: "var(--nice-warning, #ff9800)" },
2147
+ onClick: g,
2148
+ style: { ...T.button, backgroundColor: "var(--nice-warning, #ff9800)" },
1813
2149
  children: [
1814
- /* @__PURE__ */ d(G, { name: "download", size: 14 }),
2150
+ /* @__PURE__ */ d(j, { name: "download", size: 14 }),
1815
2151
  " PNG"
1816
2152
  ]
1817
2153
  }
1818
2154
  )
1819
2155
  ] });
1820
2156
  }
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)
2157
+ function Le({ width: e, height: t }) {
2158
+ const r = U(null), { service: o, plots: a, view: n, animation: i } = V(), l = 40;
2159
+ return Y(() => {
2160
+ const g = r.current, s = g == null ? void 0 : g.getContext("2d");
2161
+ if (!g || !s)
1826
2162
  return;
1827
2163
  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;
2164
+ 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
2165
  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();
2166
+ s.strokeStyle = D("var(--nice-border, #e0e0e0)", s.canvas), s.lineWidth = 0.5;
2167
+ for (let y = Math.ceil(n.xRange.min); y <= n.xRange.max; y++) {
2168
+ const b = x(y);
2169
+ s.beginPath(), s.moveTo(b, l), s.lineTo(b, t - l), s.stroke();
1834
2170
  }
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();
2171
+ for (let y = Math.ceil(n.yRange.min); y <= n.yRange.max; y++) {
2172
+ const b = f(y);
2173
+ s.beginPath(), s.moveTo(l, b), s.lineTo(e - l, b), s.stroke();
1838
2174
  }
1839
2175
  }
1840
2176
  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));
2177
+ s.strokeStyle = D("var(--nice-text, #333)", s.canvas), s.lineWidth = 1;
2178
+ const y = f(0);
2179
+ s.beginPath(), s.moveTo(l, y), s.lineTo(e - l, y), s.stroke();
2180
+ const b = x(0);
2181
+ if (s.beginPath(), s.moveTo(b, l), s.lineTo(b, t - l), s.stroke(), n.showLabels) {
2182
+ 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";
2183
+ for (let c = Math.ceil(n.xRange.min); c <= n.xRange.max; c++)
2184
+ c !== 0 && s.fillText(String(c), x(c), y + 15);
2185
+ for (let c = Math.ceil(n.yRange.min); c <= n.yRange.max; c++)
2186
+ c !== 0 && (s.textAlign = "right", s.fillText(String(c), b - 5, f(c) + 4));
1851
2187
  }
1852
2188
  }
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) {
2189
+ const w = i.isPlaying ? { [i.parameter]: i.currentValue } : {};
2190
+ for (const y of a.filter((b) => b.visible)) {
2191
+ const b = `rgb(${y.color.r},${y.color.g},${y.color.b})`;
2192
+ s.strokeStyle = b, s.lineWidth = y.lineWidth || 2;
2193
+ let c = [];
2194
+ switch (y.type) {
1859
2195
  case "2d-function":
1860
- l = o.compute2DFunction(
1861
- x.expression,
2196
+ c = o.compute2DFunction(
2197
+ y.expression,
1862
2198
  n.xRange,
1863
- x.resolution || 200,
1864
- C
2199
+ y.resolution || 200,
2200
+ w
1865
2201
  );
1866
2202
  break;
1867
2203
  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
2204
+ c = o.compute2DParametric(
2205
+ y.expression,
2206
+ y.expressionY || "sin(t)",
2207
+ y.parameterRange || { min: 0, max: 2 * Math.PI },
2208
+ y.resolution || 200,
2209
+ w
1874
2210
  );
1875
2211
  break;
1876
2212
  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
2213
+ c = o.compute2DPolar(
2214
+ y.expression,
2215
+ y.parameterRange || { min: 0, max: 2 * Math.PI },
2216
+ y.resolution || 200,
2217
+ w
1882
2218
  );
1883
2219
  break;
1884
2220
  }
1885
- if (l.length > 0) {
2221
+ if (c.length > 0) {
1886
2222
  s.beginPath();
1887
- let g = !1;
1888
- for (const w of l) {
1889
- const M = y(w.x), h = f(w.y);
2223
+ let m = !1;
2224
+ for (const k of c) {
2225
+ const C = x(k.x), h = f(k.y);
1890
2226
  if (h < 0 || h > t) {
1891
- g = !1;
2227
+ m = !1;
1892
2228
  continue;
1893
2229
  }
1894
- g ? s.lineTo(M, h) : (s.moveTo(M, h), g = !0);
2230
+ m ? s.lineTo(C, h) : (s.moveTo(C, h), m = !0);
1895
2231
  }
1896
2232
  s.stroke();
1897
2233
  }
1898
2234
  }
1899
- }, [a, n, i, o, e, t]), /* @__PURE__ */ d("canvas", { ref: r, width: e, height: t, style: $.canvas });
2235
+ }, [a, n, i, o, e, t]), /* @__PURE__ */ d("canvas", { ref: r, width: e, height: t, style: T.canvas });
1900
2236
  }
1901
- const O = [
2237
+ const G = [
1902
2238
  // Length
1903
2239
  { name: "Meter", symbol: "m", category: "Length", toBase: (e) => e, fromBase: (e) => e },
1904
2240
  {
@@ -2168,7 +2504,7 @@ const O = [
2168
2504
  fromBase: (e) => e / 1099511627776
2169
2505
  },
2170
2506
  { name: "Bit", symbol: "bit", category: "Data", toBase: (e) => e / 8, fromBase: (e) => e * 8 }
2171
- ], z = {
2507
+ ], $ = {
2172
2508
  create(e, t, r = 0) {
2173
2509
  const o = [];
2174
2510
  for (let a = 0; a < e; a++)
@@ -2245,8 +2581,8 @@ const O = [
2245
2581
  if (n === t)
2246
2582
  continue;
2247
2583
  let i = 0;
2248
- for (let c = 0; c < e.cols; c++)
2249
- c !== r && (o.data[a][i] = e.data[n][c], i++);
2584
+ for (let l = 0; l < e.cols; l++)
2585
+ l !== r && (o.data[a][i] = e.data[n][l], i++);
2250
2586
  a++;
2251
2587
  }
2252
2588
  return o;
@@ -2258,8 +2594,8 @@ const O = [
2258
2594
  const r = e.rows, o = this.create(r, r);
2259
2595
  for (let a = 0; a < r; a++)
2260
2596
  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;
2597
+ const i = Math.pow(-1, a + n), l = this.determinant(this.minor(e, a, n));
2598
+ o.data[n][a] = i * l;
2263
2599
  }
2264
2600
  return this.scalar(o, 1 / t);
2265
2601
  },
@@ -2274,11 +2610,11 @@ const O = [
2274
2610
  eigenvalues2x2(e) {
2275
2611
  if (e.rows !== 2 || e.cols !== 2)
2276
2612
  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)
2613
+ 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;
2614
+ if (l < 0)
2279
2615
  throw new Error("Complex eigenvalues not supported");
2280
- const u = Math.sqrt(c);
2281
- return [(n + u) / 2, (n - u) / 2];
2616
+ const g = Math.sqrt(l);
2617
+ return [(n + g) / 2, (n - g) / 2];
2282
2618
  },
2283
2619
  toString(e, t = 4) {
2284
2620
  return e.data.map((r) => "[ " + r.map((o) => o.toFixed(t).padStart(10)).join(" ") + " ]").join(`
@@ -2299,8 +2635,8 @@ const O = [
2299
2635
  const a = (r - t) / o;
2300
2636
  let n = e(t) + e(r);
2301
2637
  for (let i = 1; i < o; i++) {
2302
- const c = t + i * a;
2303
- n += i % 2 === 0 ? 2 * e(c) : 4 * e(c);
2638
+ const l = t + i * a;
2639
+ n += i % 2 === 0 ? 2 * e(l) : 4 * e(l);
2304
2640
  }
2305
2641
  return a / 3 * n;
2306
2642
  },
@@ -2311,10 +2647,10 @@ const O = [
2311
2647
  const i = e(a);
2312
2648
  if (Math.abs(i) < r)
2313
2649
  return a;
2314
- const c = this.derivative(e, a);
2315
- if (c === 0)
2650
+ const l = this.derivative(e, a);
2651
+ if (l === 0)
2316
2652
  throw new Error("Derivative is zero, Newton-Raphson failed");
2317
- a = a - i / c;
2653
+ a = a - i / l;
2318
2654
  }
2319
2655
  throw new Error("Newton-Raphson did not converge");
2320
2656
  },
@@ -2360,12 +2696,12 @@ const O = [
2360
2696
  return [(-t + a) / (2 * e), (-t - a) / (2 * e)];
2361
2697
  }
2362
2698
  };
2363
- class Le {
2699
+ class qe {
2364
2700
  constructor(t = {}) {
2365
- T(this, "history", []);
2366
- T(this, "memory", 0);
2367
- T(this, "variables", /* @__PURE__ */ new Map());
2368
- T(this, "config");
2701
+ z(this, "history", []);
2702
+ z(this, "memory", 0);
2703
+ z(this, "variables", /* @__PURE__ */ new Map());
2704
+ z(this, "config");
2369
2705
  this.config = {
2370
2706
  precision: t.precision ?? 12,
2371
2707
  angleUnit: t.angleUnit ?? "rad"
@@ -2378,24 +2714,24 @@ class Le {
2378
2714
  * `log` is base 10 like the key, `ln` natural; trig functions follow `angleUnit`.
2379
2715
  */
2380
2716
  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({
2717
+ 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
2718
  strict: !0,
2383
2719
  ignoreCase: !0,
2384
2720
  functions: {
2385
2721
  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))
2722
+ sin: (l) => Math.sin(o(l)),
2723
+ cos: (l) => Math.cos(o(l)),
2724
+ tan: (l) => Math.tan(o(l)),
2725
+ asin: (l) => a(Math.asin(l)),
2726
+ acos: (l) => a(Math.acos(l)),
2727
+ atan: (l) => a(Math.atan(l))
2392
2728
  }
2393
2729
  });
2394
2730
  let i;
2395
2731
  try {
2396
2732
  i = n.parse(t)(Object.fromEntries(this.variables));
2397
- } catch (c) {
2398
- throw new Error(`Invalid expression: ${c.message}`);
2733
+ } catch (l) {
2734
+ throw new Error(`Invalid expression: ${l.message}`);
2399
2735
  }
2400
2736
  if (!Number.isFinite(i))
2401
2737
  throw new Error("Invalid expression: Invalid result");
@@ -2448,7 +2784,7 @@ class Le {
2448
2784
  }
2449
2785
  /** Convert units */
2450
2786
  convertUnits(t, r, o) {
2451
- const a = O.find((c) => c.symbol === r), n = O.find((c) => c.symbol === o);
2787
+ const a = G.find((l) => l.symbol === r), n = G.find((l) => l.symbol === o);
2452
2788
  if (!a || !n)
2453
2789
  throw new Error("Unknown unit");
2454
2790
  if (a.category !== n.category)
@@ -2458,11 +2794,11 @@ class Le {
2458
2794
  }
2459
2795
  /** Get units by category */
2460
2796
  getUnitsByCategory(t) {
2461
- return O.filter((r) => r.category === t);
2797
+ return G.filter((r) => r.category === t);
2462
2798
  }
2463
2799
  /** Get all unit categories */
2464
2800
  getUnitCategories() {
2465
- return [...new Set(O.map((t) => t.category))];
2801
+ return [...new Set(G.map((t) => t.category))];
2466
2802
  }
2467
2803
  /** Format number with precision */
2468
2804
  format(t) {
@@ -2470,12 +2806,12 @@ class Le {
2470
2806
  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
2807
  }
2472
2808
  }
2473
- function ot(e) {
2474
- return new Le(e);
2809
+ function nt(e) {
2810
+ return new qe(e);
2475
2811
  }
2476
- const ce = /* @__PURE__ */ F(null);
2477
- function N() {
2478
- const e = j(ce);
2812
+ const de = /* @__PURE__ */ O(null);
2813
+ function X() {
2814
+ const e = F(de);
2479
2815
  if (!e)
2480
2816
  throw new Error("useCalculator must be used within CalculatorProvider");
2481
2817
  return e;
@@ -2538,76 +2874,77 @@ const B = {
2538
2874
  backgroundColor: "var(--nice-bg-tertiary, #505050)"
2539
2875
  }
2540
2876
  };
2541
- function at({
2877
+ function it({
2542
2878
  service: e,
2543
2879
  className: t,
2544
2880
  style: r
2545
2881
  }) {
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));
2882
+ const [o, a] = M("0"), [n, i] = M("standard"), [l, g] = M([]), [s, p] = M(!1), u = R(
2883
+ (y) => {
2884
+ s && /[0-9.]/.test(y) ? (a(y), p(!1)) : (a((b) => b === "0" && y !== "." ? y : b + y), p(!1));
2549
2885
  },
2550
2886
  [s]
2551
- ), y = R(() => {
2887
+ ), x = R(() => {
2552
2888
  a("0"), p(!1);
2553
2889
  }, []), f = R(() => {
2554
2890
  try {
2555
- const x = e.evaluate(o), b = e.format(x);
2556
- e.addHistory(o, b, n), u(e.getHistory()), a(b), p(!0);
2891
+ const y = e.evaluate(o), b = e.format(y);
2892
+ e.addHistory(o, b, n), g(e.getHistory()), a(b), p(!0);
2557
2893
  } catch {
2558
2894
  a("Error"), p(!0);
2559
2895
  }
2560
- }, [o, n, e]), C = {
2896
+ }, [o, n, e]), w = {
2561
2897
  service: e,
2562
2898
  display: o,
2563
2899
  setDisplay: a,
2564
2900
  mode: n,
2565
2901
  setMode: i,
2566
- history: c,
2902
+ history: l,
2567
2903
  calculate: f,
2568
- appendDigit: m,
2569
- clear: y
2904
+ appendDigit: u,
2905
+ clear: x
2570
2906
  };
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, {}),
2577
- n === "matrix" && /* @__PURE__ */ d(Ge, {}),
2578
- n === "calculus" && /* @__PURE__ */ d(je, {}),
2579
- n === "units" && /* @__PURE__ */ d(Fe, {})
2907
+ return /* @__PURE__ */ d(de.Provider, { value: w, children: /* @__PURE__ */ v("div", { className: t, style: { ...B.container, ...r }, children: [
2908
+ /* @__PURE__ */ d(Xe, {}),
2909
+ /* @__PURE__ */ d(Ne, {}),
2910
+ n === "standard" && /* @__PURE__ */ d(pe, {}),
2911
+ n === "scientific" && /* @__PURE__ */ d(je, {}),
2912
+ n === "programmer" && /* @__PURE__ */ d(Fe, {}),
2913
+ n === "matrix" && /* @__PURE__ */ d(Oe, {}),
2914
+ n === "calculus" && /* @__PURE__ */ d(Ge, {}),
2915
+ n === "units" && /* @__PURE__ */ d(Ue, {})
2580
2916
  ] }) });
2581
2917
  }
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" }
2918
+ function Xe() {
2919
+ const { t: e } = E(), { mode: t, setMode: r } = X(), o = [
2920
+ { id: "standard", label: e("calculator.standard", "Standard") },
2921
+ { id: "scientific", label: e("calculator.scientific", "Scientific") },
2922
+ { id: "programmer", label: e("calculator.programmer", "Programmer") },
2923
+ { id: "matrix", label: e("calculator.matrix", "Matrix") },
2924
+ { id: "calculus", label: e("calculator.calculus", "Calculus") },
2925
+ { id: "units", label: e("calculator.units", "Units") }
2590
2926
  ];
2591
- return /* @__PURE__ */ d("div", { style: B.modeSelector, children: r.map((o) => /* @__PURE__ */ d(
2927
+ return /* @__PURE__ */ d("div", { style: B.modeSelector, children: o.map((a) => /* @__PURE__ */ d(
2592
2928
  "button",
2593
2929
  {
2594
- onClick: () => t(o.id),
2930
+ onClick: () => r(a.id),
2595
2931
  style: {
2596
2932
  ...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)"
2933
+ backgroundColor: t === a.id ? "var(--nice-primary-hover, #1976d2)" : "transparent",
2934
+ color: t === a.id ? "var(--nice-color-white, #fff)" : "var(--nice-text-secondary, #888)"
2599
2935
  },
2600
- children: o.label
2936
+ children: a.label
2601
2937
  },
2602
- o.id
2938
+ a.id
2603
2939
  )) });
2604
2940
  }
2605
- function qe() {
2606
- const { display: e } = N();
2941
+ function Ne() {
2942
+ const { display: e } = X();
2607
2943
  return /* @__PURE__ */ d("div", { style: B.display, children: /* @__PURE__ */ d("div", { style: B.displayText, children: e }) });
2608
2944
  }
2609
- function le() {
2610
- const { appendDigit: e, clear: t, calculate: r, setDisplay: o, display: a } = N(), n = [
2945
+ function pe() {
2946
+ const { appendDigit: e, clear: t, calculate: r, setDisplay: o, display: a } = X(), n = [
2947
+ // audit-allow: i18n — the calculator key, the same in every language
2611
2948
  { label: "AC", action: t, style: B.keyFunction },
2612
2949
  {
2613
2950
  label: "±",
@@ -2633,16 +2970,16 @@ function le() {
2633
2970
  { label: "⌫", action: () => o(a.length > 1 ? a.slice(0, -1) : "0") },
2634
2971
  { label: "=", action: r, style: B.keyOperator }
2635
2972
  ];
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)) });
2973
+ 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
2974
  }
2638
- function Ne() {
2975
+ function je() {
2639
2976
  const {
2640
2977
  appendDigit: e,
2641
2978
  clear: t,
2642
2979
  calculate: r,
2643
2980
  setDisplay: o,
2644
2981
  display: a
2645
- } = N(), n = [
2982
+ } = X(), n = [
2646
2983
  { label: "sin", action: () => e("sin(") },
2647
2984
  { label: "cos", action: () => e("cos(") },
2648
2985
  { label: "tan", action: () => e("tan(") },
@@ -2651,34 +2988,37 @@ function Ne() {
2651
2988
  ], i = [
2652
2989
  { label: "x²", action: () => e("^2") },
2653
2990
  { label: "x³", action: () => e("^3") },
2991
+ // audit-allow: i18n — math notation
2654
2992
  { label: "xʸ", action: () => e("^") },
2655
2993
  { label: "√", action: () => e("sqrt(") },
2994
+ // audit-allow: i18n — math notation
2656
2995
  { label: "eˣ", action: () => e("exp(") }
2657
- ], c = [
2996
+ ], l = [
2658
2997
  { label: "(", action: () => e("(") },
2659
2998
  { label: ")", action: () => e(")") },
2660
2999
  { label: "π", action: () => e("π") },
2661
3000
  { label: "e", action: () => e("e") },
3001
+ // audit-allow: i18n — the calculator key, the same in every language
2662
3002
  { label: "AC", action: t }
2663
3003
  ];
2664
3004
  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(
3005
+ /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(5, 1fr)" }, children: [...n, ...i, ...l].map((g, s) => /* @__PURE__ */ d(
2666
3006
  "button",
2667
3007
  {
2668
- onClick: u.action,
3008
+ onClick: g.action,
2669
3009
  style: { ...B.key, ...B.keyFunction, padding: "12px" },
2670
- children: u.label
3010
+ children: g.label
2671
3011
  },
2672
3012
  s
2673
3013
  )) }),
2674
- /* @__PURE__ */ d(le, {})
3014
+ /* @__PURE__ */ d(pe, {})
2675
3015
  ] });
2676
3016
  }
2677
- function Xe() {
2678
- const { display: e, setDisplay: t, service: r } = N(), [o, a] = P("DEC"), n = (c) => {
3017
+ function Fe() {
3018
+ const { display: e, setDisplay: t, service: r } = X(), [o, a] = M("DEC"), n = (l) => {
2679
3019
  try {
2680
- const u = r.convertBase(e, o, c);
2681
- t(u), a(c);
3020
+ const g = r.convertBase(e, o, l);
3021
+ t(g), a(l);
2682
3022
  } catch {
2683
3023
  t("Error");
2684
3024
  }
@@ -2693,33 +3033,33 @@ function Xe() {
2693
3033
  padding: "8px",
2694
3034
  backgroundColor: "var(--nice-bg-secondary, #252525)"
2695
3035
  },
2696
- children: ["BIN", "OCT", "DEC", "HEX"].map((c) => /* @__PURE__ */ d(
3036
+ children: ["BIN", "OCT", "DEC", "HEX"].map((l) => /* @__PURE__ */ d(
2697
3037
  "button",
2698
3038
  {
2699
- onClick: () => n(c),
3039
+ onClick: () => n(l),
2700
3040
  style: {
2701
3041
  flex: 1,
2702
3042
  padding: "8px",
2703
3043
  border: "none",
2704
3044
  borderRadius: "4px",
2705
- backgroundColor: o === c ? "var(--nice-primary-hover, #1976d2)" : "var(--nice-border, #3c3c3c)",
3045
+ backgroundColor: o === l ? "var(--nice-primary-hover, #1976d2)" : "var(--nice-border, #3c3c3c)",
2706
3046
  color: "var(--nice-color-white, #fff)",
2707
3047
  cursor: "pointer"
2708
3048
  },
2709
- children: c
3049
+ children: l
2710
3050
  },
2711
- c
3051
+ l
2712
3052
  ))
2713
3053
  }
2714
3054
  ),
2715
- i.length > 0 && /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(6, 1fr)" }, children: i.map((c) => /* @__PURE__ */ d(
3055
+ i.length > 0 && /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(6, 1fr)" }, children: i.map((l) => /* @__PURE__ */ d(
2716
3056
  "button",
2717
3057
  {
2718
- onClick: () => t(e === "0" ? c : e + c),
3058
+ onClick: () => t(e === "0" ? l : e + l),
2719
3059
  style: B.key,
2720
- children: c
3060
+ children: l
2721
3061
  },
2722
- c
3062
+ l
2723
3063
  )) }),
2724
3064
  /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(4, 1fr)" }, children: [
2725
3065
  "7",
@@ -2738,31 +3078,33 @@ function Xe() {
2738
3078
  "NOT",
2739
3079
  "<<",
2740
3080
  ">>"
2741
- ].map((c) => {
2742
- const u = ["AND", "OR", "XOR", "NOT", "<<", ">>"].includes(c);
3081
+ ].map((l) => {
3082
+ const g = ["AND", "OR", "XOR", "NOT", "<<", ">>"].includes(l);
2743
3083
  return /* @__PURE__ */ d(
2744
3084
  "button",
2745
3085
  {
2746
- onClick: () => t(e === "0" ? c : e + c),
2747
- style: { ...B.key, ...u ? B.keyFunction : {} },
2748
- children: c
3086
+ onClick: () => t(e === "0" ? l : e + l),
3087
+ style: { ...B.key, ...g ? B.keyFunction : {} },
3088
+ children: l
2749
3089
  },
2750
- c
3090
+ l
2751
3091
  );
2752
3092
  }) })
2753
3093
  ] });
2754
3094
  }
2755
- 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)) }
3095
+ function Oe() {
3096
+ 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) => {
3097
+ const w = { ...s, data: s.data.map((y) => [...y]) };
3098
+ w.data[u][x] = parseFloat(f) || 0, p(w);
3099
+ }, g = [
3100
+ { label: "A + B", fn: () => $.toString($.add(t, o)) },
3101
+ { label: "A - B", fn: () => $.toString($.subtract(t, o)) },
3102
+ { label: "A × B", fn: () => $.toString($.multiply(t, o)) },
3103
+ // audit-allow: i18n — math notation
3104
+ { label: "det(A)", fn: () => $.determinant(t).toFixed(4) },
3105
+ // audit-allow: i18n — math notation
3106
+ { label: "Aᵀ", fn: () => $.toString($.transpose(t)) },
3107
+ { label: "A⁻¹", fn: () => $.toString($.inverse(t)) }
2766
3108
  ];
2767
3109
  return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2768
3110
  /* @__PURE__ */ v("div", { style: { display: "flex", gap: "12px", marginBottom: "12px" }, children: [
@@ -2772,7 +3114,7 @@ function Ge() {
2772
3114
  re,
2773
3115
  {
2774
3116
  matrix: t,
2775
- onChange: (s, p, m) => c(t, r, s, p, m)
3117
+ onChange: (s, p, u) => l(t, r, s, p, u)
2776
3118
  }
2777
3119
  )
2778
3120
  ] }),
@@ -2782,12 +3124,12 @@ function Ge() {
2782
3124
  re,
2783
3125
  {
2784
3126
  matrix: o,
2785
- onChange: (s, p, m) => c(o, a, s, p, m)
3127
+ onChange: (s, p, u) => l(o, a, s, p, u)
2786
3128
  }
2787
3129
  )
2788
3130
  ] })
2789
3131
  ] }),
2790
- /* @__PURE__ */ d("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap", marginBottom: "12px" }, children: u.map((s) => /* @__PURE__ */ d(
3132
+ /* @__PURE__ */ d("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap", marginBottom: "12px" }, children: g.map((s) => /* @__PURE__ */ d(
2791
3133
  "button",
2792
3134
  {
2793
3135
  onClick: () => {
@@ -2853,8 +3195,8 @@ function re({
2853
3195
  }
2854
3196
  );
2855
3197
  }
2856
- function je() {
2857
- const { t: e } = L(), [t, r] = P("x^2"), [o, a] = P("");
3198
+ function Ge() {
3199
+ const { t: e } = E(), [t, r] = M("x^2"), [o, a] = M("");
2858
3200
  return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2859
3201
  /* @__PURE__ */ d(
2860
3202
  "input",
@@ -2921,24 +3263,24 @@ function je() {
2921
3263
  )
2922
3264
  ] });
2923
3265
  }
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 = () => {
3266
+ function Ue() {
3267
+ 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
3268
  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);
3269
+ const y = t.convertUnits(parseFloat(r), a, i);
3270
+ u(`${r} ${a} = ${t.format(y)} ${i}`);
3271
+ } catch (y) {
3272
+ u(y.message);
2931
3273
  }
2932
3274
  };
2933
3275
  return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2934
3276
  /* @__PURE__ */ d(
2935
3277
  "select",
2936
3278
  {
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));
3279
+ value: g,
3280
+ onChange: (y) => {
3281
+ s(y.target.value);
3282
+ const b = t.getUnitsByCategory(y.target.value);
3283
+ b.length >= 2 && (n(b[0].symbol), l(b[1].symbol));
2942
3284
  },
2943
3285
  style: {
2944
3286
  width: "100%",
@@ -2949,7 +3291,7 @@ function Fe() {
2949
3291
  border: "1px solid var(--nice-border-color, #555)",
2950
3292
  borderRadius: "4px"
2951
3293
  },
2952
- children: y.map((x) => /* @__PURE__ */ d("option", { value: x, children: x }, x))
3294
+ children: x.map((y) => /* @__PURE__ */ d("option", { value: y, children: y }, y))
2953
3295
  }
2954
3296
  ),
2955
3297
  /* @__PURE__ */ v("div", { style: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }, children: [
@@ -2958,7 +3300,7 @@ function Fe() {
2958
3300
  {
2959
3301
  type: "number",
2960
3302
  value: r,
2961
- onChange: (x) => o(x.target.value),
3303
+ onChange: (y) => o(y.target.value),
2962
3304
  style: {
2963
3305
  flex: 1,
2964
3306
  padding: "8px",
@@ -2973,7 +3315,7 @@ function Fe() {
2973
3315
  "select",
2974
3316
  {
2975
3317
  value: a,
2976
- onChange: (x) => n(x.target.value),
3318
+ onChange: (y) => n(y.target.value),
2977
3319
  style: {
2978
3320
  padding: "8px",
2979
3321
  backgroundColor: "var(--nice-border, #3c3c3c)",
@@ -2981,22 +3323,22 @@ function Fe() {
2981
3323
  border: "1px solid var(--nice-border-color, #555)",
2982
3324
  borderRadius: "4px"
2983
3325
  },
2984
- children: f.map((x) => /* @__PURE__ */ v("option", { value: x.symbol, children: [
2985
- x.name,
3326
+ children: f.map((y) => /* @__PURE__ */ v("option", { value: y.symbol, children: [
3327
+ y.name,
2986
3328
  " (",
2987
- x.symbol,
3329
+ y.symbol,
2988
3330
  ")"
2989
- ] }, x.symbol))
3331
+ ] }, y.symbol))
2990
3332
  }
2991
3333
  )
2992
3334
  ] }),
2993
3335
  /* @__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 }) }),
3336
+ /* @__PURE__ */ d("span", { style: { color: "var(--nice-text-secondary, #888)" }, children: /* @__PURE__ */ d(j, { name: "arrow-right", size: 12 }) }),
2995
3337
  /* @__PURE__ */ d(
2996
3338
  "select",
2997
3339
  {
2998
3340
  value: i,
2999
- onChange: (x) => c(x.target.value),
3341
+ onChange: (y) => l(y.target.value),
3000
3342
  style: {
3001
3343
  flex: 1,
3002
3344
  padding: "8px",
@@ -3005,19 +3347,19 @@ function Fe() {
3005
3347
  border: "1px solid var(--nice-border-color, #555)",
3006
3348
  borderRadius: "4px"
3007
3349
  },
3008
- children: f.map((x) => /* @__PURE__ */ v("option", { value: x.symbol, children: [
3009
- x.name,
3350
+ children: f.map((y) => /* @__PURE__ */ v("option", { value: y.symbol, children: [
3351
+ y.name,
3010
3352
  " (",
3011
- x.symbol,
3353
+ y.symbol,
3012
3354
  ")"
3013
- ] }, x.symbol))
3355
+ ] }, y.symbol))
3014
3356
  }
3015
3357
  )
3016
3358
  ] }),
3017
3359
  /* @__PURE__ */ d(
3018
3360
  "button",
3019
3361
  {
3020
- onClick: C,
3362
+ onClick: w,
3021
3363
  style: {
3022
3364
  width: "100%",
3023
3365
  padding: "12px",
@@ -3045,7 +3387,7 @@ function Fe() {
3045
3387
  )
3046
3388
  ] });
3047
3389
  }
3048
- const E = {
3390
+ const I = {
3049
3391
  /** Distance between two points */
3050
3392
  distance(e, t) {
3051
3393
  return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
@@ -3082,21 +3424,21 @@ const E = {
3082
3424
  },
3083
3425
  /** Circle-line intersection */
3084
3426
  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)
3427
+ 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;
3428
+ if (u < 0)
3087
3429
  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;
3430
+ const x = Math.sqrt(u), f = (-s - x) / (2 * g), w = (-s + x) / (2 * g), y = [];
3431
+ 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
3432
  },
3091
3433
  /** Circle-circle intersection */
3092
3434
  circleCircleIntersection(e, t, r, o) {
3093
3435
  const a = this.distance(e, r);
3094
3436
  if (a > t + o || a < Math.abs(t - o) || a === 0)
3095
3437
  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;
3438
+ 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
3439
  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 }
3440
+ { x: l + i * (r.y - e.y) / a, y: g - i * (r.x - e.x) / a },
3441
+ { x: l - i * (r.y - e.y) / a, y: g + i * (r.x - e.x) / a }
3100
3442
  ];
3101
3443
  },
3102
3444
  /** Perpendicular line through point */
@@ -3193,10 +3535,10 @@ const E = {
3193
3535
  };
3194
3536
  }
3195
3537
  };
3196
- class Oe {
3538
+ class Ye {
3197
3539
  constructor() {
3198
- T(this, "elements", /* @__PURE__ */ new Map());
3199
- T(this, "nextLabel", 1);
3540
+ z(this, "elements", /* @__PURE__ */ new Map());
3541
+ z(this, "nextLabel", 1);
3200
3542
  }
3201
3543
  /** Add element */
3202
3544
  addElement(t) {
@@ -3330,7 +3672,7 @@ class Oe {
3330
3672
  const o = this.getPoint(t), a = this.getPoint(r);
3331
3673
  if (!o || !a)
3332
3674
  return null;
3333
- const n = E.midpoint(o, a), i = this.createPoint(n.x, n.y);
3675
+ const n = I.midpoint(o, a), i = this.createPoint(n.x, n.y);
3334
3676
  return i.dependencies = [t, r], i.color = { r: 0, g: 150, b: 0 }, i;
3335
3677
  }
3336
3678
  /** Create perpendicular */
@@ -3338,7 +3680,7 @@ class Oe {
3338
3680
  const a = this.getPoint(t), n = this.getPoint(r), i = this.getPoint(o);
3339
3681
  if (!a || !n || !i)
3340
3682
  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);
3683
+ const l = I.perpendicularThrough(a, n, i), g = this.createPoint(l.p2.x, l.p2.y), s = this.createLine(o, g.id);
3342
3684
  return s.dependencies = [t, r, o], s;
3343
3685
  }
3344
3686
  /** Create parallel */
@@ -3346,7 +3688,7 @@ class Oe {
3346
3688
  const a = this.getPoint(t), n = this.getPoint(r), i = this.getPoint(o);
3347
3689
  if (!a || !n || !i)
3348
3690
  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);
3691
+ const l = I.parallelThrough(a, n, i), g = this.createPoint(l.p2.x, l.p2.y), s = this.createLine(o, g.id);
3350
3692
  return s.dependencies = [t, r, o], s;
3351
3693
  }
3352
3694
  /** Create intersection point */
@@ -3356,36 +3698,36 @@ class Oe {
3356
3698
  return [];
3357
3699
  const n = [], i = (s) => {
3358
3700
  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];
3701
+ const p = s, u = this.getPoint(p.point1Id ?? p.originId), x = this.getPoint(p.point2Id ?? p.throughId);
3702
+ if (u && x)
3703
+ return [u, x];
3362
3704
  }
3363
3705
  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]);
3706
+ }, l = i(o), g = i(a);
3707
+ if (l && g) {
3708
+ const s = I.lineIntersection(l[0], l[1], g[0], g[1]);
3367
3709
  if (s) {
3368
3710
  const p = this.createPoint(s.x, s.y);
3369
3711
  p.dependencies = [t, r], p.color = { r: 255, g: 0, b: 0 }, n.push(p);
3370
3712
  }
3371
3713
  }
3372
- if (o.type === "circle" && u) {
3714
+ if (o.type === "circle" && g) {
3373
3715
  const s = o, p = this.getPoint(s.centerId);
3374
3716
  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);
3717
+ const u = I.circleLineIntersection(p, s.radius, g[0], g[1]);
3718
+ for (const x of u) {
3719
+ const f = this.createPoint(x.x, x.y);
3378
3720
  f.dependencies = [t, r], f.color = { r: 255, g: 0, b: 0 }, n.push(f);
3379
3721
  }
3380
3722
  }
3381
3723
  }
3382
3724
  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);
3725
+ const s = o, p = a, u = this.getPoint(s.centerId), x = this.getPoint(p.centerId);
3726
+ if (u && x) {
3727
+ const f = I.circleCircleIntersection(u, s.radius, x, p.radius);
3728
+ for (const w of f) {
3729
+ const y = this.createPoint(w.x, w.y);
3730
+ y.dependencies = [t, r], y.color = { r: 255, g: 0, b: 0 }, n.push(y);
3389
3731
  }
3390
3732
  }
3391
3733
  }
@@ -3397,13 +3739,13 @@ class Oe {
3397
3739
  case "distance": {
3398
3740
  const o = this.getPoint(r[0]), a = this.getPoint(r[1]);
3399
3741
  if (o && a)
3400
- return E.distance(o, a);
3742
+ return I.distance(o, a);
3401
3743
  break;
3402
3744
  }
3403
3745
  case "angle": {
3404
3746
  const o = this.getPoint(r[0]), a = this.getPoint(r[1]), n = this.getPoint(r[2]);
3405
3747
  if (o && a && n)
3406
- return E.angleDegrees(o, a, n);
3748
+ return I.angleDegrees(o, a, n);
3407
3749
  break;
3408
3750
  }
3409
3751
  case "area":
@@ -3411,7 +3753,7 @@ class Oe {
3411
3753
  const o = this.elements.get(r[0]);
3412
3754
  if ((o == null ? void 0 : o.type) === "polygon") {
3413
3755
  const a = o.pointIds.map((n) => this.getPoint(n)).filter(Boolean);
3414
- return t === "area" ? E.polygonArea(a) : E.polygonPerimeter(a);
3756
+ return t === "area" ? I.polygonArea(a) : I.polygonPerimeter(a);
3415
3757
  }
3416
3758
  break;
3417
3759
  }
@@ -3426,19 +3768,19 @@ class Oe {
3426
3768
  a.push(
3427
3769
  `<rect width="100%" height="100%" fill="rgb(${o.backgroundColor.r},${o.backgroundColor.g},${o.backgroundColor.b})"/>`
3428
3770
  );
3429
- const n = (i, c) => ({
3771
+ const n = (i, l) => ({
3430
3772
  x: t / 2 + (i - o.centerX) * o.scale,
3431
- y: r / 2 - (c - o.centerY) * o.scale
3773
+ y: r / 2 - (l - o.centerY) * o.scale
3432
3774
  });
3433
3775
  if (o.showGrid) {
3434
3776
  a.push('<g stroke="var(--nice-border, #ddd)" stroke-width="0.5">');
3435
3777
  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}"/>`);
3778
+ const l = n(i, 0);
3779
+ a.push(`<line x1="${l.x}" y1="0" x2="${l.x}" y2="${r}"/>`);
3438
3780
  }
3439
3781
  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}"/>`);
3782
+ const l = n(0, i);
3783
+ a.push(`<line x1="0" y1="${l.y}" x2="${t}" y2="${l.y}"/>`);
3442
3784
  }
3443
3785
  a.push("</g>");
3444
3786
  }
@@ -3449,39 +3791,39 @@ class Oe {
3449
3791
  for (const i of this.getAllElements()) {
3450
3792
  if (!i.visible)
3451
3793
  continue;
3452
- const c = `rgb(${i.color.r},${i.color.g},${i.color.b})`;
3794
+ const l = `rgb(${i.color.r},${i.color.g},${i.color.b})`;
3453
3795
  switch (i.type) {
3454
3796
  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>`);
3797
+ const g = n(i.x, i.y);
3798
+ 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
3799
  break;
3458
3800
  }
3459
3801
  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);
3802
+ const g = this.getPoint(i.point1Id), s = this.getPoint(i.point2Id);
3803
+ if (g && s) {
3804
+ const p = n(g.x, g.y), u = n(s.x, s.y);
3463
3805
  a.push(
3464
- `<line x1="${p.x}" y1="${p.y}" x2="${m.x}" y2="${m.y}" stroke="${c}" stroke-width="${i.width}"/>`
3806
+ `<line x1="${p.x}" y1="${p.y}" x2="${u.x}" y2="${u.y}" stroke="${l}" stroke-width="${i.width}"/>`
3465
3807
  );
3466
3808
  }
3467
3809
  break;
3468
3810
  }
3469
3811
  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";
3812
+ const g = this.getPoint(i.centerId);
3813
+ if (g) {
3814
+ 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
3815
  a.push(
3474
- `<circle cx="${s.x}" cy="${s.y}" r="${p}" fill="${m}" stroke="${c}" stroke-width="${i.width}"/>`
3816
+ `<circle cx="${s.x}" cy="${s.y}" r="${p}" fill="${u}" stroke="${l}" stroke-width="${i.width}"/>`
3475
3817
  );
3476
3818
  }
3477
3819
  break;
3478
3820
  }
3479
3821
  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";
3822
+ const g = i.pointIds.map((s) => this.getPoint(s)).filter(Boolean);
3823
+ if (g.length > 0) {
3824
+ 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
3825
  a.push(
3484
- `<path d="${p}" fill="${m}" stroke="${c}" stroke-width="${i.width}"/>`
3826
+ `<path d="${p}" fill="${u}" stroke="${l}" stroke-width="${i.width}"/>`
3485
3827
  );
3486
3828
  }
3487
3829
  break;
@@ -3499,12 +3841,12 @@ class Oe {
3499
3841
  return this.nextLabel++, r < 26 ? t[r] : t[r % 26] + Math.floor(r / 26);
3500
3842
  }
3501
3843
  }
3502
- function nt() {
3503
- return new Oe();
3844
+ function st() {
3845
+ return new Ye();
3504
3846
  }
3505
- const de = /* @__PURE__ */ F(null);
3847
+ const ge = /* @__PURE__ */ O(null);
3506
3848
  function H() {
3507
- const e = j(de);
3849
+ const e = F(ge);
3508
3850
  if (!e)
3509
3851
  throw new Error("useGeometry must be used within GeometryProvider");
3510
3852
  return e;
@@ -3558,14 +3900,14 @@ const q = {
3558
3900
  color: "var(--nice-text-secondary, #666)"
3559
3901
  }
3560
3902
  };
3561
- function it({
3903
+ function lt({
3562
3904
  service: e,
3563
3905
  width: t = 800,
3564
3906
  height: r = 600,
3565
3907
  className: o,
3566
3908
  style: a
3567
3909
  }) {
3568
- const [n, i] = P([]), [c, u] = P("point"), [s, p] = P([]), [m, y] = P({
3910
+ const [n, i] = M([]), [l, g] = M("point"), [s, p] = M([]), [u, x] = M({
3569
3911
  centerX: 0,
3570
3912
  centerY: 0,
3571
3913
  scale: 40,
@@ -3577,119 +3919,134 @@ function it({
3577
3919
  backgroundColor: { r: 255, g: 255, b: 255 }
3578
3920
  }), f = R(() => {
3579
3921
  i(e.getAllElements());
3580
- }, [e]), C = R((b) => {
3581
- y((l) => ({ ...l, ...b }));
3922
+ }, [e]), w = R((b) => {
3923
+ x((c) => ({ ...c, ...b }));
3582
3924
  }, []);
3583
- V(() => {
3925
+ Y(() => {
3584
3926
  f();
3585
3927
  }, [f]);
3586
- const x = {
3928
+ const y = {
3587
3929
  service: e,
3588
3930
  elements: n,
3589
- tool: c,
3590
- setTool: u,
3591
- view: m,
3592
- setView: C,
3931
+ tool: l,
3932
+ setTool: g,
3933
+ view: u,
3934
+ setView: w,
3593
3935
  selectedIds: s,
3594
3936
  setSelectedIds: p,
3595
3937
  refresh: f
3596
3938
  };
3597
- return /* @__PURE__ */ d(de.Provider, { value: x, children: /* @__PURE__ */ v("div", { className: o, style: { ...q.container, ...a }, children: [
3598
- /* @__PURE__ */ d(Ue, {}),
3939
+ return /* @__PURE__ */ d(ge.Provider, { value: y, children: /* @__PURE__ */ v("div", { className: o, style: { ...q.container, ...a }, children: [
3940
+ /* @__PURE__ */ d(Ve, {}),
3599
3941
  /* @__PURE__ */ v("div", { style: q.main, children: [
3600
- /* @__PURE__ */ d(Ve, { width: t, height: r }),
3601
- /* @__PURE__ */ d(Ye, { width: t, height: r })
3942
+ /* @__PURE__ */ d(Ke, { width: t, height: r }),
3943
+ /* @__PURE__ */ d(We, { width: t, height: r })
3602
3944
  ] })
3603
3945
  ] }) });
3604
3946
  }
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" }
3947
+ function Ve() {
3948
+ const { t: e } = E(), { tool: t, setTool: r } = H(), o = [
3949
+ { id: "select", icon: "cursor", title: e("geometry.select", "Select") },
3950
+ { id: "point", icon: "point", title: e("geometry.point", "Point") },
3951
+ { id: "segment", icon: "segment", title: e("geometry.segment", "Segment") },
3952
+ { id: "line", icon: "line", title: e("geometry.line", "Line") },
3953
+ { id: "ray", icon: "arrow-right", title: e("geometry.ray", "Ray") },
3954
+ { id: "circle", icon: "circle", title: e("geometry.circle", "Circle") },
3955
+ { id: "polygon", icon: "triangle", title: e("geometry.polygon", "Polygon") },
3956
+ {
3957
+ id: "perpendicular",
3958
+ icon: "perpendicular",
3959
+ title: e("geometry.perpendicular", "Perpendicular")
3960
+ },
3961
+ { id: "parallel", icon: "parallel", title: e("geometry.parallel", "Parallel") },
3962
+ { id: "midpoint", icon: "midpoint", title: e("geometry.midpoint", "Midpoint") },
3963
+ {
3964
+ id: "bisector",
3965
+ icon: "angle-bisector",
3966
+ title: e("geometry.angleBisector", "Angle Bisector")
3967
+ },
3968
+ { id: "intersection", icon: "close", title: e("geometry.intersection", "Intersection") },
3969
+ { id: "reflect", icon: "shuffle", title: e("geometry.reflect", "Reflect") },
3970
+ { id: "rotate", icon: "refresh", title: e("geometry.rotate", "Rotate") },
3971
+ { id: "measure", icon: "ruler", title: e("geometry.measure", "Measure") }
3622
3972
  ];
3623
- return /* @__PURE__ */ d("div", { style: q.toolbar, children: r.map((o) => /* @__PURE__ */ d(
3973
+ return /* @__PURE__ */ d("div", { style: q.toolbar, children: o.map((a) => /* @__PURE__ */ d(
3624
3974
  "button",
3625
3975
  {
3626
- onClick: () => t(o.id),
3627
- title: o.title,
3976
+ onClick: () => r(a.id),
3977
+ title: a.title,
3628
3978
  style: {
3629
3979
  ...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)"
3980
+ backgroundColor: t === a.id ? "var(--nice-primary-hover, #1976d2)" : "transparent",
3981
+ color: t === a.id ? "var(--nice-color-white, #fff)" : "var(--nice-text, #333)"
3632
3982
  },
3633
- children: /^[a-z][a-z0-9-]*$/.test(o.icon) ? /* @__PURE__ */ d(G, { name: o.icon, size: 16 }) : o.icon
3983
+ children: /* @__PURE__ */ d(j, { name: a.icon, size: 16 })
3634
3984
  },
3635
- o.id
3985
+ a.id
3636
3986
  )) });
3637
3987
  }
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;
3988
+ function Ke({ width: e, height: t }) {
3989
+ const r = U(null), { service: o, elements: a, tool: n, view: i, selectedIds: l, setSelectedIds: g, refresh: s } = H(), [p, u] = M([]), x = R(
3990
+ (b, c) => {
3991
+ const m = (b - e / 2) / i.scale + i.centerX, k = -(c - t / 2) / i.scale + i.centerY;
3642
3992
  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 };
3993
+ x: Math.round(m / i.gridSpacing) * i.gridSpacing,
3994
+ y: Math.round(k / i.gridSpacing) * i.gridSpacing
3995
+ } : { x: m, y: k };
3646
3996
  },
3647
3997
  [e, t, i]
3648
3998
  ), f = R(
3649
- (b, l) => ({
3999
+ (b, c) => ({
3650
4000
  x: e / 2 + (b - i.centerX) * i.scale,
3651
- y: t / 2 - (l - i.centerY) * i.scale
4001
+ y: t / 2 - (c - i.centerY) * i.scale
3652
4002
  }),
3653
4003
  [e, t, i]
3654
- ), C = R(
4004
+ ), w = R(
3655
4005
  (b) => {
3656
- var w;
3657
- const l = (w = r.current) == null ? void 0 : w.getBoundingClientRect();
3658
- if (!l)
4006
+ for (const m of a)
4007
+ if (m.type === "point" && I.distance(m, b) < 0.5)
4008
+ return m;
4009
+ },
4010
+ [a]
4011
+ ), y = R(
4012
+ (b) => {
4013
+ var k;
4014
+ const c = (k = r.current) == null ? void 0 : k.getBoundingClientRect();
4015
+ if (!c)
3659
4016
  return;
3660
- const g = y(b.clientX - l.left, b.clientY - l.top);
4017
+ const m = x(b.clientX - c.left, b.clientY - c.top);
3661
4018
  switch (n) {
3662
4019
  case "point": {
3663
- o.createPoint(g.x, g.y), s();
4020
+ o.createPoint(m.x, m.y), s();
3664
4021
  break;
3665
4022
  }
3666
4023
  case "segment":
3667
4024
  case "line":
3668
4025
  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;
4026
+ const C = w(m);
4027
+ if (C)
4028
+ u((h) => {
4029
+ const P = [...h, C.id];
4030
+ 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
4031
  });
3675
4032
  else {
3676
- const h = o.createPoint(g.x, g.y);
3677
- m((k) => {
3678
- const S = [...k, h.id];
4033
+ const h = o.createPoint(m.x, m.y);
4034
+ u((P) => {
4035
+ const S = [...P, h.id];
3679
4036
  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
4037
  }), s();
3681
4038
  }
3682
4039
  break;
3683
4040
  }
3684
4041
  case "circle": {
3685
- const M = x(g);
3686
- if (M)
3687
- m((h) => {
4042
+ const C = w(m);
4043
+ if (C)
4044
+ u((h) => {
3688
4045
  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);
4046
+ return [C.id];
4047
+ const P = o.getPoint(h[0]);
4048
+ if (P) {
4049
+ const S = I.distance(P, m);
3693
4050
  o.createCircle(h[0], S), s();
3694
4051
  }
3695
4052
  return [];
@@ -3697,202 +4054,188 @@ function Ve({ width: e, height: t }) {
3697
4054
  else if (p.length === 1) {
3698
4055
  const h = o.getPoint(p[0]);
3699
4056
  if (h) {
3700
- const k = E.distance(h, g);
3701
- o.createCircle(p[0], k), s(), m([]);
4057
+ const P = I.distance(h, m);
4058
+ o.createCircle(p[0], P), s(), u([]);
3702
4059
  }
3703
4060
  } else {
3704
- const h = o.createPoint(g.x, g.y);
3705
- m([h.id]), s();
4061
+ const h = o.createPoint(m.x, m.y);
4062
+ u([h.id]), s();
3706
4063
  }
3707
4064
  break;
3708
4065
  }
3709
4066
  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;
4067
+ const C = w(m);
4068
+ C && u((h) => {
4069
+ const P = [...h, C.id];
4070
+ return P.length === 2 ? (o.createMidpoint(P[0], P[1]), s(), []) : P;
3714
4071
  });
3715
4072
  break;
3716
4073
  }
3717
4074
  case "select": {
3718
- const M = x(g);
3719
- u(M ? [M.id] : []);
4075
+ const C = w(m);
4076
+ g(C ? [C.id] : []);
3720
4077
  break;
3721
4078
  }
3722
4079
  }
3723
4080
  },
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();
4081
+ [n, o, s, x, p, g, w]
4082
+ );
4083
+ return Y(() => {
4084
+ const b = r.current, c = b == null ? void 0 : b.getContext("2d");
4085
+ if (!(!b || !c)) {
4086
+ if (c.fillStyle = `rgb(${i.backgroundColor.r},${i.backgroundColor.g},${i.backgroundColor.b})`, c.fillRect(0, 0, e, t), i.showGrid) {
4087
+ c.strokeStyle = D("var(--nice-border, #e0e0e0)", c.canvas), c.lineWidth = 0.5;
4088
+ const m = i.gridSpacing * i.scale, k = (e / 2 - i.centerX * i.scale) % m, C = (t / 2 + i.centerY * i.scale) % m;
4089
+ for (let h = k; h < e; h += m)
4090
+ c.beginPath(), c.moveTo(h, 0), c.lineTo(h, t), c.stroke();
4091
+ for (let h = C; h < t; h += m)
4092
+ c.beginPath(), c.moveTo(0, h), c.lineTo(e, h), c.stroke();
3740
4093
  }
3741
4094
  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();
4095
+ const m = f(0, 0);
4096
+ 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
4097
  }
3745
- for (const g of a) {
3746
- if (!g.visible)
4098
+ for (const m of a) {
4099
+ if (!m.visible)
3747
4100
  continue;
3748
- const w = `rgb(${g.color.r},${g.color.g},${g.color.b})`, M = c.includes(g.id);
3749
- switch (g.type) {
4101
+ const k = `rgb(${m.color.r},${m.color.g},${m.color.b})`, C = l.includes(m.id);
4102
+ switch (m.type) {
3750
4103
  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));
4104
+ const h = f(m.x, m.y);
4105
+ 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
4106
  break;
3754
4107
  }
3755
4108
  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();
4109
+ const h = o.getPoint(m.point1Id), P = o.getPoint(m.point2Id);
4110
+ if (h && P) {
4111
+ const S = f(h.x, h.y), L = f(P.x, P.y);
4112
+ c.strokeStyle = k, c.lineWidth = m.width, c.beginPath(), c.moveTo(S.x, S.y), c.lineTo(L.x, L.y), c.stroke();
3760
4113
  }
3761
4114
  break;
3762
4115
  }
3763
4116
  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();
4117
+ const h = o.getPoint(m.point1Id), P = o.getPoint(m.point2Id);
4118
+ if (h && P) {
4119
+ 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);
4120
+ c.strokeStyle = k, c.lineWidth = m.width, c.beginPath(), c.moveTo(J.x, J.y), c.lineTo(Q.x, Q.y), c.stroke();
3768
4121
  }
3769
4122
  break;
3770
4123
  }
3771
4124
  case "circle": {
3772
- const h = o.getPoint(g.centerId);
4125
+ const h = o.getPoint(m.centerId);
3773
4126
  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();
4127
+ const P = f(h.x, h.y), S = m.radius * i.scale;
4128
+ 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
4129
  }
3777
4130
  break;
3778
4131
  }
3779
4132
  case "polygon": {
3780
- const h = g.pointIds.map((k) => o.getPoint(k)).filter(Boolean);
4133
+ const h = m.pointIds.map((P) => o.getPoint(P)).filter(Boolean);
3781
4134
  if (h.length > 0) {
3782
- l.beginPath();
3783
- const k = f(h[0].x, h[0].y);
3784
- l.moveTo(k.x, k.y);
4135
+ c.beginPath();
4136
+ const P = f(h[0].x, h[0].y);
4137
+ c.moveTo(P.x, P.y);
3785
4138
  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);
4139
+ const L = f(h[S].x, h[S].y);
4140
+ c.lineTo(L.x, L.y);
3788
4141
  }
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();
4142
+ 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
4143
  }
3791
4144
  break;
3792
4145
  }
3793
4146
  }
3794
4147
  }
3795
4148
  if (p.length > 0) {
3796
- l.fillStyle = I(
4149
+ c.fillStyle = D(
3797
4150
  "var(--nice-primary-tint-30, rgba(25, 118, 210, 0.3))",
3798
- l.canvas
4151
+ c.canvas
3799
4152
  );
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();
4153
+ for (const m of p) {
4154
+ const k = o.getPoint(m);
4155
+ if (k) {
4156
+ const C = f(k.x, k.y);
4157
+ c.beginPath(), c.arc(C.x, C.y, 12, 0, 2 * Math.PI), c.fill();
3805
4158
  }
3806
4159
  }
3807
4160
  }
3808
4161
  }
3809
- }, [a, i, e, t, c, p, o, f]), /* @__PURE__ */ d(
4162
+ }, [a, i, e, t, l, p, o, f]), /* @__PURE__ */ d(
3810
4163
  "canvas",
3811
4164
  {
3812
4165
  ref: r,
3813
4166
  width: e,
3814
4167
  height: t,
3815
4168
  style: q.canvas,
3816
- onClick: C
4169
+ onClick: y
3817
4170
  }
3818
4171
  );
3819
4172
  }
3820
- function Ye({
4173
+ function We({
3821
4174
  width: e,
3822
4175
  height: t
3823
4176
  }) {
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;
4177
+ const { t: r } = E(), { tool: o, elements: a, view: n, service: i } = H(), [l, g] = M(null), s = {
4178
+ select: r("geometry.select", "Select"),
4179
+ point: r("geometry.point", "Point"),
4180
+ line: r("geometry.line", "Line"),
4181
+ ray: r("geometry.ray", "Ray"),
4182
+ segment: r("geometry.segment", "Segment"),
4183
+ circle: r("geometry.circle", "Circle"),
4184
+ arc: r("geometry.arc", "Arc"),
4185
+ polygon: r("geometry.polygon", "Polygon"),
4186
+ angle: r("geometry.angle", "Angle"),
4187
+ perpendicular: r("geometry.perpendicular", "Perpendicular"),
4188
+ parallel: r("geometry.parallel", "Parallel"),
4189
+ bisector: r("geometry.angleBisector", "Angle Bisector"),
4190
+ midpoint: r("geometry.midpoint", "Midpoint"),
4191
+ tangent: r("geometry.tangent", "Tangent"),
4192
+ intersection: r("geometry.intersection", "Intersection"),
4193
+ reflect: r("geometry.reflect", "Reflect"),
4194
+ rotate: r("geometry.rotate", "Rotate"),
4195
+ translate: r("geometry.translate", "Translate"),
4196
+ dilate: r("geometry.dilate", "Dilate"),
4197
+ measure: r("geometry.measure", "Measure"),
4198
+ text: r("geometry.text", "Text")
4199
+ }, p = a.filter((u) => u.type === "point").length;
3847
4200
  return /* @__PURE__ */ v("div", { style: q.statusBar, children: [
3848
- /* @__PURE__ */ v("span", { children: [
3849
- "Tool: ",
3850
- u[r]
3851
- ] }),
4201
+ /* @__PURE__ */ d("span", { children: r("geometry.tool", "Tool: {tool}").replace("{tool}", String(s[o])) }),
3852
4202
  /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
3853
- /* @__PURE__ */ v("span", { children: [
3854
- "Objects: ",
3855
- o.length
3856
- ] }),
4203
+ /* @__PURE__ */ d("span", { children: r("geometry.objects", "Objects: {elements}").replace(
4204
+ "{elements}",
4205
+ String(a.length)
4206
+ ) }),
3857
4207
  /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
3858
- /* @__PURE__ */ v("span", { children: [
3859
- "Points: ",
3860
- s
3861
- ] }),
4208
+ /* @__PURE__ */ d("span", { children: r("geometry.points", "Points: {pointCount}").replace("{pointCount}", String(p)) }),
3862
4209
  /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
3863
- /* @__PURE__ */ v("span", { children: [
3864
- "Scale: ",
3865
- a.scale.toFixed(1),
3866
- "x"
3867
- ] })
4210
+ /* @__PURE__ */ d("span", { children: r("geometry.scaleX", "Scale: {scale}x").replace("{scale}", String(n.scale.toFixed(1))) })
3868
4211
  ] });
3869
4212
  }
3870
4213
  export {
3871
- Le as CalculatorService,
4214
+ qe as CalculatorService,
3872
4215
  te as CalculusOps,
3873
- we as EQUATION_TEMPLATES,
3874
- ie as ExpressionParser,
4216
+ Pe as EQUATION_TEMPLATES,
4217
+ le as ExpressionParser,
3875
4218
  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,
4219
+ I as GeoMath,
4220
+ Ye as GeometryService,
4221
+ $e as GraphService,
4222
+ we as MATH_SYMBOLS,
4223
+ Me as MathEditorService,
4224
+ $ as MatrixOps,
4225
+ it as NiceCalculator,
4226
+ lt as NiceGeometry,
4227
+ at as NiceGraphPlotter,
4228
+ et as NiceI18nProvider,
4229
+ rt as NiceMathEditor,
4230
+ nt as createCalculatorService,
4231
+ st as createGeometryService,
4232
+ ot as createGraphService,
4233
+ tt as createMathEditorService,
4234
+ ke as getSymbolsByCategory,
3892
4235
  Ce as recognizeHandwriting,
3893
- N as useCalculator,
4236
+ X as useCalculator,
3894
4237
  H as useGeometry,
3895
- Y as useGraph,
4238
+ V as useGraph,
3896
4239
  W as useMathEditor,
3897
- L as useNiceTranslation
4240
+ E as useNiceTranslation
3898
4241
  };