@nice2dev/ui-math 1.2.0 → 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 T = Object.defineProperty;
2
- var R = (e, t, r) => t in e ? T(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var M = (e, t, r) => R(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
- import { NiceAppShell, NiceIcon } from "@nice2dev/ui";
6
- import { NiceTutorialButton, resolveTutorial, resolveCssColor, NiceIcon as NiceIcon$1 } from "@nice2dev/ui-core";
7
- import React, { createContext, useMemo, useContext, useState, useRef, useCallback, useEffect } from "react";
8
- const translations = {
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
+ import { jsx as d, jsxs as v, Fragment as oe } from "react/jsx-runtime";
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",
@@ -23,7 +23,47 @@ const translations = {
23
23
  "editor.recognizing": "Recognizing...",
24
24
  "editor.latexInput": "LaTeX Input",
25
25
  "editor.handwriting": "Handwriting",
26
- "editor.handwritingNote": "Draw your equation above. Handwriting recognition requires external API integration."
26
+ "editor.handwritingNote": "Draw your equation above. Handwriting recognition requires external API integration.",
27
+ "editor.templates": "Templates",
28
+ "editor.copyLatex": "Copy LaTeX",
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):"
27
67
  },
28
68
  pl: {
29
69
  "calculator.matrixA": "Macierz A",
@@ -42,7 +82,47 @@ const translations = {
42
82
  "editor.recognizing": "Rozpoznawanie...",
43
83
  "editor.latexInput": "Wpis LaTeX",
44
84
  "editor.handwriting": "Pismo odręczne",
45
- "editor.handwritingNote": "Narysuj równanie powyżej. Rozpoznawanie pisma wymaga zewnętrznej integracji API."
85
+ "editor.handwritingNote": "Narysuj równanie powyżej. Rozpoznawanie pisma wymaga zewnętrznej integracji API.",
86
+ "editor.templates": "Szablony",
87
+ "editor.copyLatex": "Kopiuj LaTeX",
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):"
46
126
  },
47
127
  de: {
48
128
  "calculator.matrixA": "Matrix A",
@@ -61,7 +141,47 @@ const translations = {
61
141
  "editor.recognizing": "Erkennung läuft...",
62
142
  "editor.latexInput": "LaTeX-Eingabe",
63
143
  "editor.handwriting": "Handschrift",
64
- "editor.handwritingNote": "Zeichnen Sie Ihre Gleichung oben. Die Handschrifterkennung erfordert eine externe API-Integration."
144
+ "editor.handwritingNote": "Zeichnen Sie Ihre Gleichung oben. Die Handschrifterkennung erfordert eine externe API-Integration.",
145
+ "editor.templates": "Vorlagen",
146
+ "editor.copyLatex": "LaTeX kopieren",
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):"
65
185
  },
66
186
  fr: {
67
187
  "calculator.matrixA": "Matrice A",
@@ -80,7 +200,47 @@ const translations = {
80
200
  "editor.recognizing": "Reconnaissance...",
81
201
  "editor.latexInput": "Saisie LaTeX",
82
202
  "editor.handwriting": "Écriture manuscrite",
83
- "editor.handwritingNote": "Dessinez votre équation ci-dessus. La reconnaissance d'écriture nécessite une intégration API externe."
203
+ "editor.handwritingNote": "Dessinez votre équation ci-dessus. La reconnaissance d'écriture nécessite une intégration API externe.",
204
+ "editor.templates": "Modèles",
205
+ "editor.copyLatex": "Copier le LaTeX",
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) :"
84
244
  },
85
245
  es: {
86
246
  "calculator.matrixA": "Matriz A",
@@ -99,7 +259,47 @@ const translations = {
99
259
  "editor.recognizing": "Reconociendo...",
100
260
  "editor.latexInput": "Entrada LaTeX",
101
261
  "editor.handwriting": "Escritura a mano",
102
- "editor.handwritingNote": "Dibuja tu ecuación arriba. El reconocimiento de escritura requiere integración con una API externa."
262
+ "editor.handwritingNote": "Dibuja tu ecuación arriba. El reconocimiento de escritura requiere integración con una API externa.",
263
+ "editor.templates": "Plantillas",
264
+ "editor.copyLatex": "Copiar LaTeX",
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):"
103
303
  },
104
304
  it: {
105
305
  "calculator.matrixA": "Matrice A",
@@ -118,7 +318,47 @@ const translations = {
118
318
  "editor.recognizing": "Riconoscimento...",
119
319
  "editor.latexInput": "Input LaTeX",
120
320
  "editor.handwriting": "Scrittura a mano",
121
- "editor.handwritingNote": "Disegna la tua equazione qui sopra. Il riconoscimento della scrittura richiede un’integrazione API esterna."
321
+ "editor.handwritingNote": "Disegna la tua equazione qui sopra. Il riconoscimento della scrittura richiede un’integrazione API esterna.",
322
+ "editor.templates": "Modelli",
323
+ "editor.copyLatex": "Copia LaTeX",
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):"
122
362
  },
123
363
  pt: {
124
364
  "calculator.matrixA": "Matriz A",
@@ -137,7 +377,47 @@ const translations = {
137
377
  "editor.recognizing": "A reconhecer...",
138
378
  "editor.latexInput": "Entrada LaTeX",
139
379
  "editor.handwriting": "Escrita à mão",
140
- "editor.handwritingNote": "Desenhe a sua equação acima. O reconhecimento de escrita requer integração com uma API externa."
380
+ "editor.handwritingNote": "Desenhe a sua equação acima. O reconhecimento de escrita requer integração com uma API externa.",
381
+ "editor.templates": "Modelos",
382
+ "editor.copyLatex": "Copiar LaTeX",
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):"
141
421
  },
142
422
  cs: {
143
423
  "calculator.matrixA": "Matice A",
@@ -156,7 +436,47 @@ const translations = {
156
436
  "editor.recognizing": "Rozpoznávání...",
157
437
  "editor.latexInput": "Zadání LaTeX",
158
438
  "editor.handwriting": "Rukopis",
159
- "editor.handwritingNote": "Nakreslete svou rovnici výše. Rozpoznávání rukopisu vyžaduje externí integraci API."
439
+ "editor.handwritingNote": "Nakreslete svou rovnici výše. Rozpoznávání rukopisu vyžaduje externí integraci API.",
440
+ "editor.templates": "Šablony",
441
+ "editor.copyLatex": "Kopírovat LaTeX",
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):"
160
480
  },
161
481
  uk: {
162
482
  "calculator.matrixA": "Матриця A",
@@ -175,23 +495,62 @@ const translations = {
175
495
  "editor.recognizing": "Розпізнавання...",
176
496
  "editor.latexInput": "Введення LaTeX",
177
497
  "editor.handwriting": "Рукопис",
178
- "editor.handwritingNote": "Намалюйте своє рівняння вище. Розпізнавання рукопису потребує зовнішньої інтеграції з API."
179
- }
180
- }, I18nContext = createContext({
181
- locale: "en",
182
- t: (e, t) => t ?? e
183
- });
184
- function NiceI18nProvider({ locale: e = "en", overrides: t, children: r }) {
185
- const a = useMemo(() => {
186
- const o = { ...translations.en, ...translations[e], ...t };
187
- return { locale: e, t: (i, l) => o[i] ?? l ?? i };
188
- }, [e, t]);
189
- return React.createElement(I18nContext.Provider, { value: a }, r);
498
+ "editor.handwritingNote": "Намалюйте своє рівняння вище. Розпізнавання рукопису потребує зовнішньої інтеграції з API.",
499
+ "editor.templates": "Шаблони",
500
+ "editor.copyLatex": "Копіювати LaTeX",
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);
190
548
  }
191
- function useNiceTranslation() {
192
- return useContext(I18nContext);
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;
193
552
  }
194
- const MATH_EDITOR_TOUR = [
553
+ const ve = [
195
554
  {
196
555
  target: ".nice-math-editor",
197
556
  titleKey: "tutorial.mathEditor.intro.title",
@@ -200,7 +559,7 @@ const MATH_EDITOR_TOUR = [
200
559
  content: "Write equations as LaTeX or insert symbols from the palette; switch to handwriting input, and preview the rendered formula live.",
201
560
  placement: "auto"
202
561
  }
203
- ], MATH_SYMBOLS = [
562
+ ], we = [
204
563
  // Greek lowercase
205
564
  { name: "alpha", latex: "\\alpha", category: "greek", preview: "α" },
206
565
  { name: "beta", latex: "\\beta", category: "greek", preview: "β" },
@@ -377,10 +736,10 @@ const MATH_EDITOR_TOUR = [
377
736
  preview: "{ }"
378
737
  }
379
738
  ];
380
- function getSymbolsByCategory(e) {
381
- return MATH_SYMBOLS.filter((t) => t.category === e);
739
+ function ke(e) {
740
+ return we.filter((t) => t.category === e);
382
741
  }
383
- const EQUATION_TEMPLATES = [
742
+ const Pe = [
384
743
  // Basic
385
744
  { name: "Fraction", latex: "\\frac{a}{b}", category: "basic" },
386
745
  { name: "Square root", latex: "\\sqrt{x}", category: "basic" },
@@ -439,11 +798,11 @@ const EQUATION_TEMPLATES = [
439
798
  category: "physics"
440
799
  }
441
800
  ];
442
- class MathEditorService {
801
+ class Me {
443
802
  constructor(t = {}) {
444
- M(this, "equations", /* @__PURE__ */ new Map());
445
- M(this, "config");
446
- M(this, "nextNumber");
803
+ z(this, "equations", /* @__PURE__ */ new Map());
804
+ z(this, "config");
805
+ z(this, "nextNumber");
447
806
  this.config = {
448
807
  enableNumbering: t.enableNumbering ?? !0,
449
808
  startNumber: t.startNumber ?? 1,
@@ -452,7 +811,7 @@ class MathEditorService {
452
811
  }
453
812
  /** Create new equation */
454
813
  createEquation(t, r) {
455
- const a = {
814
+ const o = {
456
815
  id: this.generateId(),
457
816
  latex: t,
458
817
  label: r,
@@ -460,17 +819,17 @@ class MathEditorService {
460
819
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
461
820
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
462
821
  };
463
- return this.equations.set(a.id, a), a;
822
+ return this.equations.set(o.id, o), o;
464
823
  }
465
824
  /** Update equation */
466
- updateEquation(t, r, a) {
467
- const o = this.equations.get(t);
468
- if (!o)
825
+ updateEquation(t, r, o) {
826
+ const a = this.equations.get(t);
827
+ if (!a)
469
828
  throw new Error(`Equation not found: ${t}`);
470
829
  const n = {
471
- ...o,
830
+ ...a,
472
831
  latex: r,
473
- label: a ?? o.label,
832
+ label: o ?? a.label,
474
833
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
475
834
  };
476
835
  return this.equations.set(t, n), n;
@@ -506,13 +865,13 @@ class MathEditorService {
506
865
  }
507
866
  /** Parse LaTeX and extract equations */
508
867
  parseLatex(t) {
509
- const r = [], a = /\\\[([\s\S]*?)\\\]/g;
510
- let o;
511
- for (; (o = a.exec(t)) !== null; )
512
- r.push(this.createEquation(o[1].trim()));
868
+ const r = [], o = /\\\[([\s\S]*?)\\\]/g;
869
+ let a;
870
+ for (; (a = o.exec(t)) !== null; )
871
+ r.push(this.createEquation(a[1].trim()));
513
872
  const n = /\\begin\{equation\}([\s\S]*?)\\end\{equation\}/g;
514
- for (; (o = n.exec(t)) !== null; ) {
515
- const i = o[1].match(/\\label\{([^}]+)\}/), l = o[1].replace(/\\label\{[^}]+\}/, "").trim();
873
+ for (; (a = n.exec(t)) !== null; ) {
874
+ const i = a[1].match(/\\label\{([^}]+)\}/), l = a[1].replace(/\\label\{[^}]+\}/, "").trim();
516
875
  r.push(this.createEquation(l, i == null ? void 0 : i[1]));
517
876
  }
518
877
  return r;
@@ -521,24 +880,24 @@ class MathEditorService {
521
880
  return Date.now().toString(36) + Math.random().toString(36).substring(2, 8);
522
881
  }
523
882
  }
524
- function createMathEditorService(e) {
525
- return new MathEditorService(e);
883
+ function tt(e) {
884
+ return new Me(e);
526
885
  }
527
- async function recognizeHandwriting(e) {
886
+ async function Ce(e) {
528
887
  return await new Promise((r) => setTimeout(r, 500)), {
529
- latex: e.reduce((r, a) => r + a.points.length, 0) > 50 ? "\\sqrt{x^2 + y^2}" : "x",
888
+ latex: e.reduce((r, o) => r + o.points.length, 0) > 50 ? "\\sqrt{x^2 + y^2}" : "x",
530
889
  confidence: 0.85,
531
890
  alternatives: ["x", "X", "\\times"]
532
891
  };
533
892
  }
534
- const MathEditorContext = createContext(null);
535
- function useMathEditor() {
536
- const e = useContext(MathEditorContext);
893
+ const se = /* @__PURE__ */ O(null);
894
+ function W() {
895
+ const e = F(se);
537
896
  if (!e)
538
897
  throw new Error("useMathEditor must be used within MathEditorProvider");
539
898
  return e;
540
899
  }
541
- const styles$3 = {
900
+ const A = {
542
901
  toolbar: {
543
902
  display: "flex",
544
903
  gap: "8px",
@@ -621,110 +980,110 @@ const styles$3 = {
621
980
  cursor: "crosshair"
622
981
  }
623
982
  };
624
- function NiceMathEditor({
983
+ function rt({
625
984
  service: e,
626
985
  initialLatex: t = "",
627
986
  onChange: r,
628
- className: a,
629
- style: o,
987
+ className: o,
988
+ style: a,
630
989
  tutorial: n
631
990
  }) {
632
- const { t: i } = useNiceTranslation(), [l, p] = useState(t), [s, d] = useState("input"), g = useRef(null), y = useCallback(
633
- (f) => {
634
- p(f), r == null || r(f);
991
+ const { t: i } = E(), [l, g] = M(t), [s, p] = M("input"), u = U(null), x = R(
992
+ (b) => {
993
+ g(b), r == null || r(b);
635
994
  },
636
995
  [r]
637
- ), h = useCallback(
638
- (f) => {
639
- const c = g.current;
996
+ ), f = R(
997
+ (b) => {
998
+ const c = u.current;
640
999
  if (!c) {
641
- y(l + f);
1000
+ x(l + b);
642
1001
  return;
643
1002
  }
644
- const u = c.selectionStart, b = c.selectionEnd, k = l.slice(0, u) + f + l.slice(b);
645
- y(k), setTimeout(() => {
646
- c.focus(), c.selectionStart = c.selectionEnd = u + f.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;
647
1006
  }, 0);
648
1007
  },
649
- [l, y]
650
- ), w = useCallback(
651
- (f) => {
652
- h(f.latex);
1008
+ [l, x]
1009
+ ), w = R(
1010
+ (b) => {
1011
+ f(b.latex);
653
1012
  },
654
- [h]
655
- ), x = {
1013
+ [f]
1014
+ ), y = {
656
1015
  service: e,
657
1016
  latex: l,
658
- setLatex: y,
659
- insertSymbol: h,
1017
+ setLatex: x,
1018
+ insertSymbol: f,
660
1019
  insertTemplate: w,
661
1020
  mode: s,
662
- setMode: d
1021
+ setMode: p
663
1022
  };
664
- return /* @__PURE__ */ jsx(MathEditorContext.Provider, { value: x, children: /* @__PURE__ */ jsxs(
665
- NiceAppShell,
1023
+ return /* @__PURE__ */ d(se.Provider, { value: y, children: /* @__PURE__ */ v(
1024
+ ye,
666
1025
  {
667
1026
  flush: !0,
668
- className: `nice-math-editor ${a ?? ""}`,
669
- style: { position: "relative", ...o },
670
- toolbar: /* @__PURE__ */ jsx(Toolbar$1, {}),
671
- sidebar: /* @__PURE__ */ jsx(SymbolPalette, {}),
1027
+ className: `nice-math-editor ${o ?? ""}`,
1028
+ style: { position: "relative", ...a },
1029
+ toolbar: /* @__PURE__ */ d(Se, {}),
1030
+ sidebar: /* @__PURE__ */ d(Be, {}),
672
1031
  children: [
673
- /* @__PURE__ */ jsx("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ jsx(NiceTutorialButton, { steps: resolveTutorial(n, MATH_EDITOR_TOUR) }) }),
674
- /* @__PURE__ */ jsx("div", { style: styles$3.editor, children: s === "input" ? /* @__PURE__ */ jsxs(Fragment, { children: [
675
- /* @__PURE__ */ jsx(
1032
+ /* @__PURE__ */ d("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ d(he, { steps: fe(n, ve) }) }),
1033
+ /* @__PURE__ */ d("div", { style: A.editor, children: s === "input" ? /* @__PURE__ */ v(oe, { children: [
1034
+ /* @__PURE__ */ d(
676
1035
  "textarea",
677
1036
  {
678
- ref: g,
1037
+ ref: u,
679
1038
  value: l,
680
- onChange: (f) => y(f.target.value),
1039
+ onChange: (b) => x(b.target.value),
681
1040
  placeholder: i("editor.latexPlaceholder", "Enter LaTeX equation..."),
682
- style: styles$3.input
1041
+ style: A.input
683
1042
  }
684
1043
  ),
685
- /* @__PURE__ */ jsx(LatexPreview, { latex: l })
686
- ] }) : /* @__PURE__ */ jsx(HandwritingCanvas, {}) })
1044
+ /* @__PURE__ */ d(Te, { latex: l })
1045
+ ] }) : /* @__PURE__ */ d(Re, {}) })
687
1046
  ]
688
1047
  }
689
1048
  ) });
690
1049
  }
691
- function Toolbar$1() {
692
- const { t: e } = useNiceTranslation(), { mode: t, setMode: r, latex: a, insertTemplate: o } = useMathEditor(), [n, i] = useState(!1);
693
- return /* @__PURE__ */ jsxs("div", { style: styles$3.toolbar, children: [
694
- /* @__PURE__ */ jsxs(
1050
+ function Se() {
1051
+ const { t: e } = E(), { mode: t, setMode: r, latex: o, insertTemplate: a } = W(), [n, i] = M(!1);
1052
+ return /* @__PURE__ */ v("div", { style: A.toolbar, children: [
1053
+ /* @__PURE__ */ v(
695
1054
  "button",
696
1055
  {
697
1056
  onClick: () => r("input"),
698
1057
  style: {
699
- ...styles$3.button,
1058
+ ...A.button,
700
1059
  backgroundColor: t === "input" ? "var(--nice-primary-hover, #1976d2)" : "var(--nice-bg-tertiary, #9e9e9e)",
701
1060
  // the inactive state sits on a theme surface: theme text, not the button's white
702
1061
  color: t === "input" ? "var(--nice-color-white, #fff)" : "var(--nice-text-primary, #fff)"
703
1062
  },
704
1063
  children: [
705
- /* @__PURE__ */ jsx(NiceIcon, { name: "keyboard", size: 14 }),
1064
+ /* @__PURE__ */ d(N, { name: "keyboard", size: 14 }),
706
1065
  " ",
707
1066
  e("editor.latexInput", "LaTeX Input")
708
1067
  ]
709
1068
  }
710
1069
  ),
711
- /* @__PURE__ */ jsxs(
1070
+ /* @__PURE__ */ v(
712
1071
  "button",
713
1072
  {
714
1073
  onClick: () => r("handwriting"),
715
1074
  style: {
716
- ...styles$3.button,
1075
+ ...A.button,
717
1076
  backgroundColor: t === "handwriting" ? "var(--nice-primary-hover, #1976d2)" : "var(--nice-bg-tertiary, #9e9e9e)",
718
1077
  color: t === "handwriting" ? "var(--nice-color-white, #fff)" : "var(--nice-text-primary, #fff)"
719
1078
  },
720
1079
  children: [
721
- /* @__PURE__ */ jsx(NiceIcon, { name: "pen", size: 14 }),
1080
+ /* @__PURE__ */ d(N, { name: "pen", size: 14 }),
722
1081
  " ",
723
1082
  e("editor.handwriting", "Handwriting")
724
1083
  ]
725
1084
  }
726
1085
  ),
727
- /* @__PURE__ */ jsx(
1086
+ /* @__PURE__ */ d(
728
1087
  "div",
729
1088
  {
730
1089
  style: {
@@ -734,13 +1093,15 @@ function Toolbar$1() {
734
1093
  }
735
1094
  }
736
1095
  ),
737
- /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
738
- /* @__PURE__ */ jsxs("button", { onClick: () => i(!n), style: styles$3.button, children: [
739
- /* @__PURE__ */ jsx(NiceIcon, { name: "ruler", size: 14 }),
740
- " Templates ",
741
- /* @__PURE__ */ jsx(NiceIcon, { name: "chevron-down", size: 12 })
1096
+ /* @__PURE__ */ v("div", { style: { position: "relative" }, children: [
1097
+ /* @__PURE__ */ v("button", { onClick: () => i(!n), style: A.button, children: [
1098
+ /* @__PURE__ */ d(N, { name: "ruler", size: 14 }),
1099
+ " ",
1100
+ e("editor.templates", "Templates"),
1101
+ " ",
1102
+ /* @__PURE__ */ d(N, { name: "chevron-down", size: 12 })
742
1103
  ] }),
743
- n && /* @__PURE__ */ jsx(
1104
+ n && /* @__PURE__ */ d(
744
1105
  "div",
745
1106
  {
746
1107
  style: {
@@ -757,13 +1118,13 @@ function Toolbar$1() {
757
1118
  overflow: "auto"
758
1119
  },
759
1120
  children: ["basic", "calculus", "algebra", "geometry", "statistics", "physics"].map(
760
- (l) => /* @__PURE__ */ jsxs("div", { children: [
761
- /* @__PURE__ */ jsx("div", { style: styles$3.categoryHeader, children: l }),
762
- EQUATION_TEMPLATES.filter((p) => p.category === l).map((p) => /* @__PURE__ */ jsxs(
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(
763
1124
  "div",
764
1125
  {
765
1126
  onClick: () => {
766
- o(p), i(!1);
1127
+ a(g), i(!1);
767
1128
  },
768
1129
  style: {
769
1130
  padding: "8px 12px",
@@ -773,8 +1134,8 @@ function Toolbar$1() {
773
1134
  onMouseOver: (s) => s.target.style.backgroundColor = "var(--nice-bg-secondary, #f5f5f5)",
774
1135
  onMouseOut: (s) => s.target.style.backgroundColor = "transparent",
775
1136
  children: [
776
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: p.name }),
777
- /* @__PURE__ */ jsxs(
1137
+ /* @__PURE__ */ d("div", { style: { fontWeight: 500 }, children: g.name }),
1138
+ /* @__PURE__ */ v(
778
1139
  "div",
779
1140
  {
780
1141
  style: {
@@ -783,36 +1144,37 @@ function Toolbar$1() {
783
1144
  fontFamily: "monospace"
784
1145
  },
785
1146
  children: [
786
- p.latex.substring(0, 40),
787
- p.latex.length > 40 ? "..." : ""
1147
+ g.latex.substring(0, 40),
1148
+ g.latex.length > 40 ? "..." : ""
788
1149
  ]
789
1150
  }
790
1151
  )
791
1152
  ]
792
1153
  },
793
- p.name
1154
+ g.name
794
1155
  ))
795
1156
  ] }, l)
796
1157
  )
797
1158
  }
798
1159
  )
799
1160
  ] }),
800
- /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
801
- /* @__PURE__ */ jsxs(
1161
+ /* @__PURE__ */ d("div", { style: { flex: 1 } }),
1162
+ /* @__PURE__ */ v(
802
1163
  "button",
803
1164
  {
804
- onClick: () => navigator.clipboard.writeText(a),
805
- style: { ...styles$3.button, backgroundColor: "var(--nice-success, #4caf50)" },
1165
+ onClick: () => navigator.clipboard.writeText(o),
1166
+ style: { ...A.button, backgroundColor: "var(--nice-success, #4caf50)" },
806
1167
  children: [
807
- /* @__PURE__ */ jsx(NiceIcon, { name: "copy", size: 14 }),
808
- " Copy LaTeX"
1168
+ /* @__PURE__ */ d(N, { name: "copy", size: 14 }),
1169
+ " ",
1170
+ e("editor.copyLatex", "Copy LaTeX")
809
1171
  ]
810
1172
  }
811
1173
  )
812
1174
  ] });
813
1175
  }
814
- function SymbolPalette() {
815
- const { insertSymbol: e } = useMathEditor(), [t, r] = useState("greek"), a = [
1176
+ function Be() {
1177
+ const { insertSymbol: e } = W(), [t, r] = M("greek"), o = [
816
1178
  "greek",
817
1179
  "operators",
818
1180
  "relations",
@@ -824,9 +1186,9 @@ function SymbolPalette() {
824
1186
  "logic",
825
1187
  "calculus",
826
1188
  "matrices"
827
- ], o = getSymbolsByCategory(t);
828
- return /* @__PURE__ */ jsxs("div", { style: styles$3.sidebar, children: [
829
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", padding: "8px", gap: "4px" }, children: a.map((n) => /* @__PURE__ */ jsx(
1189
+ ], a = ke(t);
1190
+ return /* @__PURE__ */ v("div", { style: A.sidebar, children: [
1191
+ /* @__PURE__ */ d("div", { style: { display: "flex", flexWrap: "wrap", padding: "8px", gap: "4px" }, children: o.map((n) => /* @__PURE__ */ d(
830
1192
  "button",
831
1193
  {
832
1194
  onClick: () => r(n),
@@ -843,11 +1205,11 @@ function SymbolPalette() {
843
1205
  },
844
1206
  n
845
1207
  )) }),
846
- /* @__PURE__ */ jsx("div", { style: styles$3.symbolGrid, children: o.map((n) => /* @__PURE__ */ jsx(
1208
+ /* @__PURE__ */ d("div", { style: A.symbolGrid, children: a.map((n) => /* @__PURE__ */ d(
847
1209
  "button",
848
1210
  {
849
1211
  onClick: () => e(n.latex),
850
- style: styles$3.symbolButton,
1212
+ style: A.symbolButton,
851
1213
  title: `${n.name}: ${n.latex}`,
852
1214
  children: n.preview || n.latex
853
1215
  },
@@ -855,122 +1217,126 @@ function SymbolPalette() {
855
1217
  )) })
856
1218
  ] });
857
1219
  }
858
- function LatexPreview({ latex: e }) {
859
- return /* @__PURE__ */ jsxs("div", { style: styles$3.preview, children: [
860
- /* @__PURE__ */ jsx(
1220
+ function Te({ latex: e }) {
1221
+ const { t } = E();
1222
+ return /* @__PURE__ */ v("div", { style: A.preview, children: [
1223
+ /* @__PURE__ */ d(
861
1224
  "div",
862
1225
  {
863
1226
  style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)", marginBottom: "8px" },
864
- children: "Preview (requires KaTeX/MathJax integration):"
1227
+ children: t(
1228
+ "editor.previewRequiresKatexMathjaxIntegration",
1229
+ "Preview (requires KaTeX/MathJax integration):"
1230
+ )
865
1231
  }
866
1232
  ),
867
- /* @__PURE__ */ jsx("code", { style: { fontSize: "16px" }, children: e || "(empty)" })
1233
+ /* @__PURE__ */ d("code", { style: { fontSize: "16px" }, children: e || "(empty)" })
868
1234
  ] });
869
1235
  }
870
- function HandwritingCanvas() {
871
- const { t: e } = useNiceTranslation(), { setLatex: t, setMode: r } = useMathEditor(), a = useRef(null), [o, n] = useState([]), [i, l] = useState([]), [p, s] = useState(!1), [d, g] = useState(!1), y = (c) => {
872
- const u = a.current;
873
- if (!u)
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)
874
1240
  return;
875
1241
  s(!0);
876
- const b = u.getBoundingClientRect();
1242
+ const k = m.getBoundingClientRect();
877
1243
  l([
878
1244
  {
879
- x: c.clientX - b.left,
880
- y: c.clientY - b.top,
1245
+ x: c.clientX - k.left,
1246
+ y: c.clientY - k.top,
881
1247
  pressure: c.pressure,
882
1248
  timestamp: Date.now()
883
1249
  }
884
1250
  ]);
885
- }, h = (c) => {
886
- if (!p)
1251
+ }, f = (c) => {
1252
+ if (!g)
887
1253
  return;
888
- const u = a.current, b = u == null ? void 0 : u.getContext("2d");
889
- if (!u || !b)
1254
+ const m = o.current, k = m == null ? void 0 : m.getContext("2d");
1255
+ if (!m || !k)
890
1256
  return;
891
- const k = u.getBoundingClientRect(), m = {
892
- x: c.clientX - k.left,
893
- y: c.clientY - k.top,
1257
+ const C = m.getBoundingClientRect(), h = {
1258
+ x: c.clientX - C.left,
1259
+ y: c.clientY - C.top,
894
1260
  pressure: c.pressure,
895
1261
  timestamp: Date.now()
896
1262
  };
897
- if (l((v) => [...v, m]), i.length > 0) {
898
- const v = i[i.length - 1];
899
- b.beginPath(), b.moveTo(v.x, v.y), b.lineTo(m.x, m.y), b.strokeStyle = resolveCssColor("var(--nice-text, #000)", b.canvas), b.lineWidth = 2, b.lineCap = "round", b.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();
900
1266
  }
901
1267
  }, w = () => {
902
- if (p) {
1268
+ if (g) {
903
1269
  if (s(!1), i.length > 1) {
904
1270
  const c = {
905
1271
  id: Date.now().toString(),
906
1272
  points: [...i]
907
1273
  };
908
- n((u) => [...u, c]);
1274
+ n((m) => [...m, c]);
909
1275
  }
910
1276
  l([]);
911
1277
  }
912
- }, x = () => {
913
- const c = a.current, u = c == null ? void 0 : c.getContext("2d");
914
- u && c && u.clearRect(0, 0, c.width, c.height), n([]);
915
- }, f = async () => {
916
- if (o.length !== 0) {
917
- g(!0);
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([]);
1281
+ }, b = async () => {
1282
+ if (a.length !== 0) {
1283
+ u(!0);
918
1284
  try {
919
- const c = await recognizeHandwriting(o);
1285
+ const c = await Ce(a);
920
1286
  t(c.latex), r("input");
921
1287
  } finally {
922
- g(!1);
1288
+ u(!1);
923
1289
  }
924
1290
  }
925
1291
  };
926
- return useEffect(() => {
927
- const c = a.current;
1292
+ return Y(() => {
1293
+ const c = o.current;
928
1294
  c && (c.width = c.offsetWidth, c.height = 200);
929
- }, []), /* @__PURE__ */ jsxs("div", { children: [
930
- /* @__PURE__ */ jsx(
1295
+ }, []), /* @__PURE__ */ v("div", { children: [
1296
+ /* @__PURE__ */ d(
931
1297
  "canvas",
932
1298
  {
933
- ref: a,
934
- style: styles$3.canvas,
935
- onPointerDown: y,
936
- onPointerMove: h,
1299
+ ref: o,
1300
+ style: A.canvas,
1301
+ onPointerDown: x,
1302
+ onPointerMove: f,
937
1303
  onPointerUp: w,
938
1304
  onPointerLeave: w
939
1305
  }
940
1306
  ),
941
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", marginTop: "12px" }, children: [
942
- /* @__PURE__ */ jsx(
1307
+ /* @__PURE__ */ v("div", { style: { display: "flex", gap: "8px", marginTop: "12px" }, children: [
1308
+ /* @__PURE__ */ d(
943
1309
  "button",
944
1310
  {
945
- onClick: x,
946
- style: { ...styles$3.button, backgroundColor: "var(--nice-danger, #f44336)" },
1311
+ onClick: y,
1312
+ style: { ...A.button, backgroundColor: "var(--nice-danger, #f44336)" },
947
1313
  children: e("editor.clear", "Clear")
948
1314
  }
949
1315
  ),
950
- /* @__PURE__ */ jsx(
1316
+ /* @__PURE__ */ d(
951
1317
  "button",
952
1318
  {
953
- onClick: f,
954
- disabled: o.length === 0 || d,
955
- style: styles$3.button,
956
- children: d ? e("editor.recognizing", "Recognizing...") : e("editor.recognize", "Recognize")
1319
+ onClick: b,
1320
+ disabled: a.length === 0 || p,
1321
+ style: A.button,
1322
+ children: p ? e("editor.recognizing", "Recognizing...") : e("editor.recognize", "Recognize")
957
1323
  }
958
1324
  )
959
1325
  ] }),
960
- /* @__PURE__ */ jsx("p", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)", marginTop: "8px" }, children: e(
1326
+ /* @__PURE__ */ d("p", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)", marginTop: "8px" }, children: e(
961
1327
  "editor.handwritingNote",
962
1328
  "Draw your equation above. Handwriting recognition requires external API integration."
963
1329
  ) })
964
1330
  ] });
965
1331
  }
966
- const mathConstants = {
1332
+ const ze = {
967
1333
  pi: Math.PI,
968
1334
  PI: Math.PI,
969
1335
  e: Math.E,
970
1336
  E: Math.E,
971
1337
  phi: (1 + Math.sqrt(5)) / 2,
972
1338
  tau: Math.PI * 2
973
- }, mathFunctions = {
1339
+ }, Ae = {
974
1340
  sin: Math.sin,
975
1341
  cos: Math.cos,
976
1342
  tan: Math.tan,
@@ -1002,15 +1368,19 @@ const mathConstants = {
1002
1368
  cot: (e) => 1 / Math.tan(e),
1003
1369
  ln: Math.log
1004
1370
  };
1005
- class ExpressionParser {
1006
- constructor() {
1007
- M(this, "pos", 0);
1008
- M(this, "expr", "");
1371
+ class le {
1372
+ constructor(t = {}) {
1373
+ z(this, "pos", 0);
1374
+ z(this, "expr", "");
1375
+ z(this, "options");
1376
+ this.options = t;
1009
1377
  }
1010
1378
  parse(t) {
1011
- this.expr = t.replace(/\s+/g, ""), this.pos = 0;
1379
+ this.expr = t.replace(/\s+/g, "").replace(/×/g, "*").replace(/÷/g, "/").replace(/−/g, "-").replace(/π/g, "pi").replace(/√(\d+(?:\.\d+)?)/g, "sqrt($1)").replace(/√/g, "sqrt"), this.pos = 0;
1012
1380
  const r = this.parseAddSub();
1013
- return (a) => this.evaluate(r, { ...mathConstants, ...a });
1381
+ if (this.options.strict && this.pos < this.expr.length)
1382
+ throw new Error(`Unexpected "${this.expr.slice(this.pos)}"`);
1383
+ return (o) => this.evaluate(r, o);
1014
1384
  }
1015
1385
  parseAddSub() {
1016
1386
  let t = this.parseMulDiv();
@@ -1019,102 +1389,126 @@ class ExpressionParser {
1019
1389
  if (r !== "+" && r !== "-")
1020
1390
  break;
1021
1391
  this.pos++;
1022
- const a = this.parseMulDiv();
1023
- t = { type: "binary", op: r, left: t, right: a };
1392
+ const o = this.parseMulDiv();
1393
+ t = { type: "binary", op: r, left: t, right: o };
1024
1394
  }
1025
1395
  return t;
1026
1396
  }
1027
1397
  parseMulDiv() {
1028
- let t = this.parsePower();
1398
+ let t = this.parseUnary();
1029
1399
  for (; this.pos < this.expr.length; ) {
1030
1400
  const r = this.expr[this.pos];
1031
- if (r !== "*" && r !== "/")
1401
+ if (r === "*" || r === "/")
1402
+ this.pos++, t = { type: "binary", op: r, left: t, right: this.parseUnary() };
1403
+ else if (/[0-9a-zA-Z_(]/.test(r))
1404
+ t = { type: "binary", op: "*", left: t, right: this.parsePower() };
1405
+ else
1032
1406
  break;
1033
- this.pos++;
1034
- const a = this.parsePower();
1035
- t = { type: "binary", op: r, left: t, right: a };
1036
- }
1037
- return t;
1038
- }
1039
- parsePower() {
1040
- let t = this.parseUnary();
1041
- for (; this.pos < this.expr.length && this.expr[this.pos] === "^"; ) {
1042
- this.pos++;
1043
- const r = this.parseUnary();
1044
- t = { type: "binary", op: "^", left: t, right: r };
1045
1407
  }
1046
1408
  return t;
1047
1409
  }
1048
1410
  parseUnary() {
1049
- return this.expr[this.pos] === "-" ? (this.pos++, { type: "unary", op: "-", arg: this.parseUnary() }) : (this.expr[this.pos] === "+" && this.pos++, this.parsePrimary());
1411
+ return this.expr[this.pos] === "-" ? (this.pos++, { type: "unary", arg: this.parseUnary() }) : this.expr[this.pos] === "+" ? (this.pos++, this.parseUnary()) : this.parsePower();
1412
+ }
1413
+ parsePower() {
1414
+ const t = this.parsePrimary();
1415
+ return this.expr[this.pos] === "^" ? (this.pos++, { type: "binary", op: "^", left: t, right: this.parseUnary() }) : t;
1050
1416
  }
1051
1417
  parsePrimary() {
1052
1418
  if (this.expr[this.pos] === "(") {
1053
1419
  this.pos++;
1054
- const a = this.parseAddSub();
1055
- return this.expr[this.pos] === ")" && this.pos++, a;
1420
+ const o = this.parseAddSub();
1421
+ if (this.expr[this.pos] === ")")
1422
+ this.pos++;
1423
+ else if (this.options.strict)
1424
+ throw new Error('Missing ")"');
1425
+ return o;
1056
1426
  }
1057
- const t = this.expr.slice(this.pos).match(/^(\d+\.?\d*)/);
1427
+ const t = this.expr.slice(this.pos).match(/^(\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/);
1058
1428
  if (t)
1059
- return this.pos += t[1].length, { type: "number", value: parseFloat(t[1]) };
1429
+ return this.pos += t[0].length, { type: "number", value: parseFloat(t[0]) };
1060
1430
  const r = this.expr.slice(this.pos).match(/^([a-zA-Z_][a-zA-Z0-9_]*)/);
1061
1431
  if (r) {
1062
- const a = r[1];
1063
- if (this.pos += a.length, this.expr[this.pos] === "(") {
1432
+ const o = r[1];
1433
+ if (this.pos += o.length, this.expr[this.pos] === "(") {
1064
1434
  this.pos++;
1065
- const o = [];
1435
+ const a = [];
1066
1436
  for (; this.expr[this.pos] !== ")" && this.pos < this.expr.length; )
1067
- o.push(this.parseAddSub()), this.expr[this.pos] === "," && this.pos++;
1068
- return this.expr[this.pos] === ")" && this.pos++, { type: "call", name: a, args: o };
1437
+ if (a.push(this.parseAddSub()), this.expr[this.pos] === ",")
1438
+ this.pos++;
1439
+ else if (this.expr[this.pos] !== ")")
1440
+ break;
1441
+ if (this.expr[this.pos] === ")")
1442
+ this.pos++;
1443
+ else if (this.options.strict)
1444
+ throw new Error('Missing ")"');
1445
+ return { type: "call", name: o, args: a };
1069
1446
  }
1070
- return { type: "variable", name: a };
1447
+ return { type: "variable", name: o };
1071
1448
  }
1449
+ if (this.options.strict)
1450
+ throw new Error(
1451
+ this.pos < this.expr.length ? `Unexpected "${this.expr[this.pos]}"` : "Unexpected end"
1452
+ );
1072
1453
  return { type: "number", value: 0 };
1073
1454
  }
1455
+ /** A name from a table, honouring `ignoreCase`. */
1456
+ lookup(t, r) {
1457
+ if (r in t)
1458
+ return t[r];
1459
+ if (this.options.ignoreCase) {
1460
+ const o = r.toLowerCase(), a = Object.keys(t).find((n) => n.toLowerCase() === o);
1461
+ return a === void 0 ? void 0 : t[a];
1462
+ }
1463
+ }
1074
1464
  evaluate(t, r) {
1075
1465
  switch (t.type) {
1076
1466
  case "number":
1077
1467
  return t.value;
1078
- case "variable":
1468
+ case "variable": {
1079
1469
  if (t.name in r)
1080
1470
  return r[t.name];
1471
+ const o = this.lookup({ ...ze, ...this.options.constants }, t.name);
1472
+ if (o !== void 0)
1473
+ return o;
1081
1474
  throw new Error(`Unknown variable: ${t.name}`);
1475
+ }
1082
1476
  case "unary":
1083
- return t.op === "-" ? -this.evaluate(t.arg, r) : this.evaluate(t.arg, r);
1477
+ return -this.evaluate(t.arg, r);
1084
1478
  case "binary": {
1085
- const a = this.evaluate(t.left, r), o = this.evaluate(t.right, r);
1479
+ const o = this.evaluate(t.left, r), a = this.evaluate(t.right, r);
1086
1480
  switch (t.op) {
1087
1481
  case "+":
1088
- return a + o;
1482
+ return o + a;
1089
1483
  case "-":
1090
- return a - o;
1484
+ return o - a;
1091
1485
  case "*":
1092
- return a * o;
1486
+ return o * a;
1093
1487
  case "/":
1094
- return a / o;
1488
+ return o / a;
1095
1489
  case "^":
1096
- return Math.pow(a, o);
1490
+ return Math.pow(o, a);
1097
1491
  default:
1098
1492
  return 0;
1099
1493
  }
1100
1494
  }
1101
1495
  case "call": {
1102
- const a = mathFunctions[t.name];
1103
- if (!a)
1496
+ const o = this.lookup({ ...Ae, ...this.options.functions }, t.name);
1497
+ if (!o)
1104
1498
  throw new Error(`Unknown function: ${t.name}`);
1105
- const o = t.args.map((n) => this.evaluate(n, r));
1106
- return a(...o);
1499
+ const a = t.args.map((n) => this.evaluate(n, r));
1500
+ return o(...a);
1107
1501
  }
1108
1502
  default:
1109
1503
  return 0;
1110
1504
  }
1111
1505
  }
1112
1506
  }
1113
- class GraphService {
1507
+ class $e {
1114
1508
  constructor(t = {}) {
1115
- M(this, "plots", /* @__PURE__ */ new Map());
1116
- M(this, "parser", new ExpressionParser());
1117
- M(this, "config");
1509
+ z(this, "plots", /* @__PURE__ */ new Map());
1510
+ z(this, "parser", new le());
1511
+ z(this, "config");
1118
1512
  this.config = {
1119
1513
  defaultResolution: t.defaultResolution ?? 200,
1120
1514
  maxResolution: t.maxResolution ?? 1e3
@@ -1140,11 +1534,11 @@ class GraphService {
1140
1534
  }
1141
1535
  /** Update a plot */
1142
1536
  updatePlot(t, r) {
1143
- const a = this.plots.get(t);
1144
- if (!a)
1537
+ const o = this.plots.get(t);
1538
+ if (!o)
1145
1539
  throw new Error(`Plot not found: ${t}`);
1146
- const o = { ...a, ...r, id: a.id };
1147
- return this.plots.set(t, o), o;
1540
+ const a = { ...o, ...r, id: o.id };
1541
+ return this.plots.set(t, a), a;
1148
1542
  }
1149
1543
  /** Remove a plot */
1150
1544
  removePlot(t) {
@@ -1159,41 +1553,41 @@ class GraphService {
1159
1553
  return this.plots.get(t);
1160
1554
  }
1161
1555
  /** Compute 2D function points */
1162
- compute2DFunction(t, r, a, o) {
1163
- const n = this.parser.parse(t), i = [], l = (r.max - r.min) / a;
1164
- for (let p = 0; p <= a; p++) {
1165
- const s = r.min + p * l;
1556
+ compute2DFunction(t, r, o, a) {
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;
1166
1560
  try {
1167
- const d = n({ x: s, ...o });
1168
- Number.isFinite(d) && i.push({ x: s, y: d });
1561
+ const p = n({ x: s, ...a });
1562
+ Number.isFinite(p) && i.push({ x: s, y: p });
1169
1563
  } catch {
1170
1564
  }
1171
1565
  }
1172
1566
  return i;
1173
1567
  }
1174
1568
  /** Compute 2D parametric curve */
1175
- compute2DParametric(t, r, a, o, n) {
1176
- const i = this.parser.parse(t), l = this.parser.parse(r), p = [], s = (a.max - a.min) / o;
1177
- for (let d = 0; d <= o; d++) {
1178
- const g = a.min + d * s;
1569
+ compute2DParametric(t, r, o, a, n) {
1570
+ const i = this.parser.parse(t), l = this.parser.parse(r), g = [], s = (o.max - o.min) / a;
1571
+ for (let p = 0; p <= a; p++) {
1572
+ const u = o.min + p * s;
1179
1573
  try {
1180
- const y = i({ t: g, ...n }), h = l({ t: g, ...n });
1181
- Number.isFinite(y) && Number.isFinite(h) && p.push({ x: y, y: h });
1574
+ const x = i({ t: u, ...n }), f = l({ t: u, ...n });
1575
+ Number.isFinite(x) && Number.isFinite(f) && g.push({ x, y: f });
1182
1576
  } catch {
1183
1577
  }
1184
1578
  }
1185
- return p;
1579
+ return g;
1186
1580
  }
1187
1581
  /** Compute 2D polar curve */
1188
- compute2DPolar(t, r, a, o) {
1189
- const n = this.parser.parse(t), i = [], l = (r.max - r.min) / a;
1190
- for (let p = 0; p <= a; p++) {
1191
- const s = r.min + p * l;
1582
+ compute2DPolar(t, r, o, a) {
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;
1192
1586
  try {
1193
- const d = n({ theta: s, t: s, ...o });
1194
- if (Number.isFinite(d)) {
1195
- const g = d * Math.cos(s), y = d * Math.sin(s);
1196
- i.push({ x: g, y });
1587
+ const p = n({ theta: s, t: s, ...a });
1588
+ if (Number.isFinite(p)) {
1589
+ const u = p * Math.cos(s), x = p * Math.sin(s);
1590
+ i.push({ x: u, y: x });
1197
1591
  }
1198
1592
  } catch {
1199
1593
  }
@@ -1201,88 +1595,88 @@ class GraphService {
1201
1595
  return i;
1202
1596
  }
1203
1597
  /** Compute 3D surface points */
1204
- compute3DSurface(t, r, a, o, n) {
1205
- const i = this.parser.parse(t), l = [], p = (r.max - r.min) / o, s = (a.max - a.min) / o;
1206
- for (let d = 0; d <= o; d++) {
1207
- const g = [], y = r.min + d * p;
1208
- for (let h = 0; h <= o; h++) {
1209
- const w = a.min + h * s;
1598
+ compute3DSurface(t, r, o, a, n) {
1599
+ const i = this.parser.parse(t), l = [], g = (r.max - r.min) / a, s = (o.max - o.min) / a;
1600
+ for (let p = 0; p <= a; p++) {
1601
+ const u = [], x = r.min + p * g;
1602
+ for (let f = 0; f <= a; f++) {
1603
+ const w = o.min + f * s;
1210
1604
  try {
1211
- const x = i({ x: y, y: w, ...n });
1212
- Number.isFinite(x) ? g.push({ x: y, y: w, z: x }) : g.push({ x: y, y: w, 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 });
1213
1607
  } catch {
1214
- g.push({ x: y, y: w, z: 0 });
1608
+ u.push({ x, y: w, z: 0 });
1215
1609
  }
1216
1610
  }
1217
- l.push(g);
1611
+ l.push(u);
1218
1612
  }
1219
1613
  return l;
1220
1614
  }
1221
1615
  /** Export plot data as SVG */
1222
- exportSVG(t, r, a, o) {
1223
- const i = a - 80, l = o - 80, p = (g) => 40 + (g - r.xRange.min) / (r.xRange.max - r.xRange.min) * i, s = (g) => o - 40 - (g - r.yRange.min) / (r.yRange.max - r.yRange.min) * l, d = [
1224
- `<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${o}">`,
1616
+ exportSVG(t, r, o, a) {
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 = [
1618
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${a}">`,
1225
1619
  `<rect width="100%" height="100%" fill="rgb(${r.backgroundColor.r},${r.backgroundColor.g},${r.backgroundColor.b})"/>`
1226
1620
  ];
1227
1621
  if (r.showGrid) {
1228
- d.push('<g stroke="var(--nice-border, #ddd)" stroke-width="0.5">');
1229
- for (let g = Math.ceil(r.xRange.min); g <= r.xRange.max; g++) {
1230
- const y = p(g);
1231
- d.push(`<line x1="${y}" y1="40" x2="${y}" y2="${o - 40}"/>`);
1622
+ p.push('<g stroke="var(--nice-border, #ddd)" stroke-width="0.5">');
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}"/>`);
1232
1626
  }
1233
- for (let g = Math.ceil(r.yRange.min); g <= r.yRange.max; g++) {
1234
- const y = s(g);
1235
- d.push(`<line x1="40" y1="${y}" x2="${a - 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}"/>`);
1236
1630
  }
1237
- d.push("</g>");
1631
+ p.push("</g>");
1238
1632
  }
1239
1633
  if (r.showAxes) {
1240
- d.push('<g stroke="var(--nice-text, #333)" stroke-width="1">');
1241
- const g = s(0), y = p(0);
1242
- d.push(`<line x1="40" y1="${g}" x2="${a - 40}" y2="${g}"/>`), d.push(`<line x1="${y}" y1="40" x2="${y}" y2="${o - 40}"/>`), d.push("</g>");
1634
+ p.push('<g stroke="var(--nice-text, #333)" stroke-width="1">');
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>");
1243
1637
  }
1244
- for (const g of t.filter((y) => y.visible))
1245
- if (g.type === "2d-function") {
1246
- const y = this.compute2DFunction(g.expression, r.xRange, g.resolution || 200);
1247
- if (y.length > 0) {
1248
- const h = y.map((w, x) => `${x === 0 ? "M" : "L"}${p(w.x)},${s(w.y)}`).join(" ");
1249
- d.push(
1250
- `<path d="${h}" fill="none" stroke="rgb(${g.color.r},${g.color.g},${g.color.b})" stroke-width="${g.lineWidth}"/>`
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(" ");
1643
+ p.push(
1644
+ `<path d="${f}" fill="none" stroke="rgb(${u.color.r},${u.color.g},${u.color.b})" stroke-width="${u.lineWidth}"/>`
1251
1645
  );
1252
1646
  }
1253
1647
  }
1254
- return r.showLabels && (d.push(
1255
- `<text x="${a / 2}" y="${o - 10}" text-anchor="middle" font-size="12">x</text>`
1256
- ), d.push(
1257
- `<text x="10" y="${o / 2}" text-anchor="middle" font-size="12" transform="rotate(-90,10,${o / 2})">y</text>`
1258
- )), d.push("</svg>"), d.join(`
1648
+ return r.showLabels && (p.push(
1649
+ `<text x="${o / 2}" y="${a - 10}" text-anchor="middle" font-size="12">x</text>`
1650
+ ), p.push(
1651
+ `<text x="10" y="${a / 2}" text-anchor="middle" font-size="12" transform="rotate(-90,10,${a / 2})">y</text>`
1652
+ )), p.push("</svg>"), p.join(`
1259
1653
  `);
1260
1654
  }
1261
1655
  /** Export as PNG (data URL) */
1262
- async exportPNG(t, r, a, o) {
1263
- const n = this.exportSVG(t, r, a, o);
1656
+ async exportPNG(t, r, o, a) {
1657
+ const n = this.exportSVG(t, r, o, a);
1264
1658
  return new Promise((i, l) => {
1265
- const p = new Image();
1266
- p.onload = () => {
1659
+ const g = new Image();
1660
+ g.onload = () => {
1267
1661
  const s = document.createElement("canvas");
1268
- s.width = a, s.height = o;
1269
- const d = s.getContext("2d");
1270
- if (!d) {
1662
+ s.width = o, s.height = a;
1663
+ const p = s.getContext("2d");
1664
+ if (!p) {
1271
1665
  l(new Error("Could not get canvas context"));
1272
1666
  return;
1273
1667
  }
1274
- d.drawImage(p, 0, 0), i(s.toDataURL("image/png"));
1275
- }, p.onerror = l, p.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);
1276
1670
  });
1277
1671
  }
1278
1672
  generateId() {
1279
1673
  return Date.now().toString(36) + Math.random().toString(36).substring(2, 8);
1280
1674
  }
1281
1675
  }
1282
- function createGraphService(e) {
1283
- return new GraphService(e);
1676
+ function ot(e) {
1677
+ return new $e(e);
1284
1678
  }
1285
- const FUNCTION_PRESETS = [
1679
+ const ee = [
1286
1680
  // Basic
1287
1681
  { name: "Linear", expression: "x", type: "2d-function", category: "basic" },
1288
1682
  { name: "Quadratic", expression: "x^2", type: "2d-function", category: "basic" },
@@ -1365,14 +1759,14 @@ const FUNCTION_PRESETS = [
1365
1759
  type: "3d-surface",
1366
1760
  category: "3d"
1367
1761
  }
1368
- ], GraphContext = createContext(null);
1369
- function useGraph() {
1370
- const e = useContext(GraphContext);
1762
+ ], ce = /* @__PURE__ */ O(null);
1763
+ function V() {
1764
+ const e = F(ce);
1371
1765
  if (!e)
1372
1766
  throw new Error("useGraph must be used within GraphProvider");
1373
1767
  return e;
1374
1768
  }
1375
- const styles$2 = {
1769
+ const T = {
1376
1770
  container: {
1377
1771
  display: "flex",
1378
1772
  height: "100%",
@@ -1431,14 +1825,14 @@ const styles$2 = {
1431
1825
  backgroundColor: "var(--nice-bg-secondary, #fafafa)"
1432
1826
  }
1433
1827
  };
1434
- function NiceGraphPlotter({
1828
+ function at({
1435
1829
  service: e,
1436
1830
  width: t = 800,
1437
1831
  height: r = 600,
1438
- className: a,
1439
- style: o
1832
+ className: o,
1833
+ style: a
1440
1834
  }) {
1441
- const [n, i] = useState([]), [l, p] = useState({
1835
+ const [n, i] = M([]), [l, g] = M({
1442
1836
  xRange: { min: -10, max: 10 },
1443
1837
  yRange: { min: -10, max: 10 },
1444
1838
  zRange: { min: -5, max: 5 },
@@ -1449,63 +1843,63 @@ function NiceGraphPlotter({
1449
1843
  cameraRotationX: 30,
1450
1844
  cameraRotationY: 45,
1451
1845
  cameraDistance: 5
1452
- }), [s, d] = useState({
1846
+ }), [s, p] = M({
1453
1847
  isPlaying: !1,
1454
1848
  parameter: "a",
1455
1849
  currentValue: 0,
1456
1850
  minValue: -5,
1457
1851
  maxValue: 5,
1458
1852
  speed: 1
1459
- }), g = useCallback(() => {
1853
+ }), u = R(() => {
1460
1854
  i(e.getPlots());
1461
- }, [e]), y = useCallback((u) => {
1462
- p((b) => ({ ...b, ...u }));
1463
- }, []), h = useCallback((u) => {
1464
- d((b) => ({ ...b, ...u }));
1465
- }, []), w = useCallback(
1466
- (u) => {
1467
- e.addPlot(u), g();
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();
1468
1862
  },
1469
- [e, g]
1470
- ), x = useCallback(
1471
- (u) => {
1472
- e.removePlot(u), g();
1863
+ [e, u]
1864
+ ), y = R(
1865
+ (m) => {
1866
+ e.removePlot(m), u();
1473
1867
  },
1474
- [e, g]
1475
- ), f = useCallback(
1476
- (u, b) => {
1477
- e.updatePlot(u, b), g();
1868
+ [e, u]
1869
+ ), b = R(
1870
+ (m, k) => {
1871
+ e.updatePlot(m, k), u();
1478
1872
  },
1479
- [e, g]
1873
+ [e, u]
1480
1874
  ), c = {
1481
1875
  service: e,
1482
1876
  plots: n,
1483
1877
  view: l,
1484
- setView: y,
1878
+ setView: x,
1485
1879
  addPlot: w,
1486
- removePlot: x,
1487
- updatePlot: f,
1880
+ removePlot: y,
1881
+ updatePlot: b,
1488
1882
  animation: s,
1489
- setAnimation: h,
1490
- refresh: g
1883
+ setAnimation: f,
1884
+ refresh: u
1491
1885
  };
1492
- return /* @__PURE__ */ jsx(GraphContext.Provider, { value: c, children: /* @__PURE__ */ jsxs("div", { className: a, style: { ...styles$2.container, ...o }, children: [
1493
- /* @__PURE__ */ jsxs("div", { style: styles$2.sidebar, children: [
1494
- /* @__PURE__ */ jsx(PlotControls, {}),
1495
- /* @__PURE__ */ jsx(PlotList, {})
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, {})
1496
1890
  ] }),
1497
- /* @__PURE__ */ jsxs("div", { style: styles$2.main, children: [
1498
- /* @__PURE__ */ jsx(GraphToolbar, { width: t, height: r }),
1499
- /* @__PURE__ */ jsx(Canvas2D, { 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 })
1500
1894
  ] })
1501
1895
  ] }) });
1502
1896
  }
1503
- function PlotControls() {
1504
- const { t: e } = useNiceTranslation(), { addPlot: t } = useGraph(), [r, a] = useState("sin(x)"), [o, n] = useState("2d-function"), [i, l] = useState("cos(x)"), p = () => {
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 = () => {
1505
1899
  t({
1506
- type: o,
1900
+ type: a,
1507
1901
  expression: r,
1508
- expressionY: o === "2d-parametric" ? i : void 0,
1902
+ expressionY: a === "2d-parametric" ? i : void 0,
1509
1903
  color: {
1510
1904
  r: Math.floor(Math.random() * 200),
1511
1905
  g: Math.floor(Math.random() * 200),
@@ -1513,52 +1907,52 @@ function PlotControls() {
1513
1907
  }
1514
1908
  });
1515
1909
  };
1516
- return /* @__PURE__ */ jsxs("div", { style: { padding: "12px", borderBottom: "1px solid var(--nice-border, #e0e0e0)" }, children: [
1517
- /* @__PURE__ */ jsx("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ jsxs(
1910
+ return /* @__PURE__ */ v("div", { style: { padding: "12px", borderBottom: "1px solid var(--nice-border, #e0e0e0)" }, children: [
1911
+ /* @__PURE__ */ d("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ v(
1518
1912
  "select",
1519
1913
  {
1520
- value: o,
1914
+ value: a,
1521
1915
  onChange: (s) => n(s.target.value),
1522
- style: { ...styles$2.input, width: "100%" },
1916
+ style: { ...T.input, width: "100%" },
1523
1917
  children: [
1524
- /* @__PURE__ */ jsx("option", { value: "2d-function", children: "y = f(x)" }),
1525
- /* @__PURE__ */ jsx("option", { value: "2d-parametric", children: "Parametric (x(t), y(t))" }),
1526
- /* @__PURE__ */ jsx("option", { value: "2d-polar", children: "Polar r = f(θ)" }),
1527
- /* @__PURE__ */ jsx("option", { value: "3d-surface", children: "3D Surface z = f(x,y)" })
1918
+ /* @__PURE__ */ d("option", { value: "2d-function", children: "y = f(x)" }),
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)") })
1528
1922
  ]
1529
1923
  }
1530
1924
  ) }),
1531
- /* @__PURE__ */ jsx("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ jsx(
1925
+ /* @__PURE__ */ d("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ d(
1532
1926
  "input",
1533
1927
  {
1534
1928
  type: "text",
1535
1929
  value: r,
1536
- onChange: (s) => a(s.target.value),
1537
- placeholder: o === "2d-parametric" ? "x(t) = ..." : "Expression...",
1538
- style: { ...styles$2.input, width: "100%" }
1930
+ onChange: (s) => o(s.target.value),
1931
+ placeholder: a === "2d-parametric" ? "x(t) = ..." : e("plotter.expression", "Expression..."),
1932
+ style: { ...T.input, width: "100%" }
1539
1933
  }
1540
1934
  ) }),
1541
- o === "2d-parametric" && /* @__PURE__ */ jsx("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ jsx(
1935
+ a === "2d-parametric" && /* @__PURE__ */ d("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ d(
1542
1936
  "input",
1543
1937
  {
1544
1938
  type: "text",
1545
1939
  value: i,
1546
1940
  onChange: (s) => l(s.target.value),
1547
1941
  placeholder: "y(t) = ...",
1548
- style: { ...styles$2.input, width: "100%" }
1942
+ style: { ...T.input, width: "100%" }
1549
1943
  }
1550
1944
  ) }),
1551
- /* @__PURE__ */ jsx("button", { onClick: p, style: { ...styles$2.button, width: "100%" }, children: "+ Add Plot" }),
1552
- /* @__PURE__ */ jsxs(
1945
+ /* @__PURE__ */ d("button", { onClick: g, style: { ...T.button, width: "100%" }, children: e("plotter.addPlot", "+ Add Plot") }),
1946
+ /* @__PURE__ */ v(
1553
1947
  "select",
1554
1948
  {
1555
1949
  onChange: (s) => {
1556
- const d = FUNCTION_PRESETS.find((g) => g.name === s.target.value);
1557
- d && t({
1558
- type: d.type,
1559
- expression: d.expression,
1560
- expressionY: d.expressionY,
1561
- label: d.name,
1950
+ const p = ee.find((u) => u.name === s.target.value);
1951
+ p && t({
1952
+ type: p.type,
1953
+ expression: p.expression,
1954
+ expressionY: p.expressionY,
1955
+ label: p.name,
1562
1956
  color: {
1563
1957
  r: Math.floor(Math.random() * 200),
1564
1958
  g: Math.floor(Math.random() * 200),
@@ -1566,24 +1960,24 @@ function PlotControls() {
1566
1960
  }
1567
1961
  });
1568
1962
  },
1569
- style: { ...styles$2.input, width: "100%", marginTop: "8px" },
1963
+ style: { ...T.input, width: "100%", marginTop: "8px" },
1570
1964
  value: "",
1571
1965
  children: [
1572
- /* @__PURE__ */ jsx("option", { value: "", disabled: !0, children: e("plotter.quickAdd", "Quick add preset...") }),
1573
- ["basic", "trigonometric", "exponential", "parametric", "polar", "3d"].map((s) => /* @__PURE__ */ jsx("optgroup", { label: s.charAt(0).toUpperCase() + s.slice(1), children: FUNCTION_PRESETS.filter((d) => d.category === s).map((d) => /* @__PURE__ */ jsxs("option", { value: d.name, children: [
1574
- d.name,
1966
+ /* @__PURE__ */ d("option", { value: "", disabled: !0, children: e("plotter.quickAdd", "Quick add preset...") }),
1967
+ ["basic", "trigonometric", "exponential", "parametric", "polar", "3d"].map((s) => /* @__PURE__ */ d("optgroup", { label: s.charAt(0).toUpperCase() + s.slice(1), children: ee.filter((p) => p.category === s).map((p) => /* @__PURE__ */ v("option", { value: p.name, children: [
1968
+ p.name,
1575
1969
  ": ",
1576
- d.expression
1577
- ] }, d.name)) }, s))
1970
+ p.expression
1971
+ ] }, p.name)) }, s))
1578
1972
  ]
1579
1973
  }
1580
1974
  )
1581
1975
  ] });
1582
1976
  }
1583
- function PlotList() {
1584
- const { t: e } = useNiceTranslation(), { plots: t, removePlot: r, updatePlot: a } = useGraph();
1585
- return /* @__PURE__ */ jsxs("div", { style: styles$2.plotList, children: [
1586
- t.length === 0 && /* @__PURE__ */ jsx(
1977
+ function Ee() {
1978
+ const { t: e } = E(), { plots: t, removePlot: r, updatePlot: o } = V();
1979
+ return /* @__PURE__ */ v("div", { style: T.plotList, children: [
1980
+ t.length === 0 && /* @__PURE__ */ d(
1587
1981
  "div",
1588
1982
  {
1589
1983
  style: {
@@ -1594,32 +1988,33 @@ function PlotList() {
1594
1988
  children: e("plotter.noPlots", "No plots added yet")
1595
1989
  }
1596
1990
  ),
1597
- t.map((o) => /* @__PURE__ */ jsxs("div", { style: styles$2.plotItem, children: [
1598
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginBottom: "8px" }, children: [
1599
- /* @__PURE__ */ jsx(
1991
+ t.map((a) => /* @__PURE__ */ v("div", { style: T.plotItem, children: [
1992
+ /* @__PURE__ */ v("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginBottom: "8px" }, children: [
1993
+ /* @__PURE__ */ d(
1600
1994
  "input",
1601
1995
  {
1602
1996
  type: "checkbox",
1603
- checked: o.visible,
1604
- onChange: (n) => a(o.id, { visible: n.target.checked })
1997
+ checked: a.visible,
1998
+ onChange: (n) => o(a.id, { visible: n.target.checked })
1605
1999
  }
1606
2000
  ),
1607
- /* @__PURE__ */ jsx(
2001
+ /* @__PURE__ */ d(
1608
2002
  "div",
1609
2003
  {
1610
2004
  style: {
1611
2005
  width: "16px",
1612
2006
  height: "16px",
1613
2007
  borderRadius: "3px",
1614
- backgroundColor: `rgb(${o.color.r},${o.color.g},${o.color.b})`
2008
+ backgroundColor: `rgb(${a.color.r},${a.color.g},${a.color.b})`
1615
2009
  }
1616
2010
  }
1617
2011
  ),
1618
- /* @__PURE__ */ jsx("span", { style: { flex: 1, fontWeight: 500 }, children: o.label || o.expression }),
1619
- /* @__PURE__ */ jsx(
2012
+ /* @__PURE__ */ d("span", { style: { flex: 1, fontWeight: 500 }, children: a.label || a.expression }),
2013
+ /* @__PURE__ */ d(
1620
2014
  "button",
1621
2015
  {
1622
- onClick: () => r(o.id),
2016
+ "aria-label": e("plotter.close", "Close"),
2017
+ onClick: () => r(a.id),
1623
2018
  style: {
1624
2019
  padding: "2px 6px",
1625
2020
  backgroundColor: "var(--nice-danger, #f44336)",
@@ -1629,11 +2024,11 @@ function PlotList() {
1629
2024
  cursor: "pointer",
1630
2025
  fontSize: "12px"
1631
2026
  },
1632
- children: "×"
2027
+ children: /* @__PURE__ */ d(j, { name: "close", size: 14 })
1633
2028
  }
1634
2029
  )
1635
2030
  ] }),
1636
- /* @__PURE__ */ jsx(
2031
+ /* @__PURE__ */ d(
1637
2032
  "div",
1638
2033
  {
1639
2034
  style: {
@@ -1641,79 +2036,79 @@ function PlotList() {
1641
2036
  color: "var(--nice-text-secondary, #666)",
1642
2037
  fontFamily: "monospace"
1643
2038
  },
1644
- children: o.type === "2d-parametric" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2039
+ children: a.type === "2d-parametric" ? /* @__PURE__ */ v(oe, { children: [
1645
2040
  "x(t) = ",
1646
- o.expression,
1647
- /* @__PURE__ */ jsx("br", {}),
2041
+ a.expression,
2042
+ /* @__PURE__ */ d("br", {}),
1648
2043
  "y(t) = ",
1649
- o.expressionY
1650
- ] }) : o.expression
2044
+ a.expressionY
2045
+ ] }) : a.expression
1651
2046
  }
1652
2047
  )
1653
- ] }, o.id))
2048
+ ] }, a.id))
1654
2049
  ] });
1655
2050
  }
1656
- function GraphToolbar({ width: e, height: t }) {
1657
- const { t: r } = useNiceTranslation(), { service: a, plots: o, view: n, setView: i } = useGraph(), l = () => {
1658
- const s = a.exportSVG(o, n, e, t), d = new Blob([s], { type: "image/svg+xml" }), g = URL.createObjectURL(d), y = document.createElement("a");
1659
- y.href = g, y.download = "graph.svg", y.click(), URL.revokeObjectURL(g);
1660
- }, p = async () => {
1661
- const s = await a.exportPNG(o, n, e, t), d = document.createElement("a");
1662
- d.href = s, d.download = "graph.png", d.click();
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 () => {
2056
+ const s = await o.exportPNG(a, n, e, t), p = document.createElement("a");
2057
+ p.href = s, p.download = "graph.png", p.click();
1663
2058
  };
1664
- return /* @__PURE__ */ jsxs("div", { style: styles$2.toolbar, children: [
1665
- /* @__PURE__ */ jsxs("label", { style: { fontSize: "12px" }, children: [
2059
+ return /* @__PURE__ */ v("div", { style: T.toolbar, children: [
2060
+ /* @__PURE__ */ v("label", { style: { fontSize: "12px" }, children: [
1666
2061
  "X: [",
1667
2062
  " ",
1668
- /* @__PURE__ */ jsx(
2063
+ /* @__PURE__ */ d(
1669
2064
  "input",
1670
2065
  {
1671
2066
  type: "number",
1672
2067
  value: n.xRange.min,
1673
2068
  onChange: (s) => i({ xRange: { ...n.xRange, min: Number(s.target.value) } }),
1674
- style: { ...styles$2.input, width: "50px" }
2069
+ style: { ...T.input, width: "50px" }
1675
2070
  }
1676
2071
  ),
1677
2072
  ",",
1678
2073
  " ",
1679
- /* @__PURE__ */ jsx(
2074
+ /* @__PURE__ */ d(
1680
2075
  "input",
1681
2076
  {
1682
2077
  type: "number",
1683
2078
  value: n.xRange.max,
1684
2079
  onChange: (s) => i({ xRange: { ...n.xRange, max: Number(s.target.value) } }),
1685
- style: { ...styles$2.input, width: "50px" }
2080
+ style: { ...T.input, width: "50px" }
1686
2081
  }
1687
2082
  ),
1688
2083
  "]"
1689
2084
  ] }),
1690
- /* @__PURE__ */ jsxs("label", { style: { fontSize: "12px" }, children: [
2085
+ /* @__PURE__ */ v("label", { style: { fontSize: "12px" }, children: [
1691
2086
  "Y: [",
1692
2087
  " ",
1693
- /* @__PURE__ */ jsx(
2088
+ /* @__PURE__ */ d(
1694
2089
  "input",
1695
2090
  {
1696
2091
  type: "number",
1697
2092
  value: n.yRange.min,
1698
2093
  onChange: (s) => i({ yRange: { ...n.yRange, min: Number(s.target.value) } }),
1699
- style: { ...styles$2.input, width: "50px" }
2094
+ style: { ...T.input, width: "50px" }
1700
2095
  }
1701
2096
  ),
1702
2097
  ",",
1703
2098
  " ",
1704
- /* @__PURE__ */ jsx(
2099
+ /* @__PURE__ */ d(
1705
2100
  "input",
1706
2101
  {
1707
2102
  type: "number",
1708
2103
  value: n.yRange.max,
1709
2104
  onChange: (s) => i({ yRange: { ...n.yRange, max: Number(s.target.value) } }),
1710
- style: { ...styles$2.input, width: "50px" }
2105
+ style: { ...T.input, width: "50px" }
1711
2106
  }
1712
2107
  ),
1713
2108
  "]"
1714
2109
  ] }),
1715
- /* @__PURE__ */ jsxs("label", { style: { fontSize: "12px" }, children: [
1716
- /* @__PURE__ */ jsx(
2110
+ /* @__PURE__ */ v("label", { style: { fontSize: "12px" }, children: [
2111
+ /* @__PURE__ */ d(
1717
2112
  "input",
1718
2113
  {
1719
2114
  type: "checkbox",
@@ -1723,8 +2118,8 @@ function GraphToolbar({ width: e, height: t }) {
1723
2118
  ),
1724
2119
  r("plotter.grid", "Grid")
1725
2120
  ] }),
1726
- /* @__PURE__ */ jsxs("label", { style: { fontSize: "12px" }, children: [
1727
- /* @__PURE__ */ jsx(
2121
+ /* @__PURE__ */ v("label", { style: { fontSize: "12px" }, children: [
2122
+ /* @__PURE__ */ d(
1728
2123
  "input",
1729
2124
  {
1730
2125
  type: "checkbox",
@@ -1734,112 +2129,112 @@ function GraphToolbar({ width: e, height: t }) {
1734
2129
  ),
1735
2130
  r("plotter.axes", "Axes")
1736
2131
  ] }),
1737
- /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
1738
- /* @__PURE__ */ jsxs(
2132
+ /* @__PURE__ */ d("div", { style: { flex: 1 } }),
2133
+ /* @__PURE__ */ v(
1739
2134
  "button",
1740
2135
  {
1741
2136
  onClick: l,
1742
- style: { ...styles$2.button, backgroundColor: "var(--nice-success, #4caf50)" },
2137
+ style: { ...T.button, backgroundColor: "var(--nice-success, #4caf50)" },
1743
2138
  children: [
1744
- /* @__PURE__ */ jsx(NiceIcon$1, { name: "download", size: 14 }),
2139
+ /* @__PURE__ */ d(j, { name: "download", size: 14 }),
1745
2140
  " SVG"
1746
2141
  ]
1747
2142
  }
1748
2143
  ),
1749
- /* @__PURE__ */ jsxs(
2144
+ /* @__PURE__ */ v(
1750
2145
  "button",
1751
2146
  {
1752
- onClick: p,
1753
- style: { ...styles$2.button, backgroundColor: "var(--nice-warning, #ff9800)" },
2147
+ onClick: g,
2148
+ style: { ...T.button, backgroundColor: "var(--nice-warning, #ff9800)" },
1754
2149
  children: [
1755
- /* @__PURE__ */ jsx(NiceIcon$1, { name: "download", size: 14 }),
2150
+ /* @__PURE__ */ d(j, { name: "download", size: 14 }),
1756
2151
  " PNG"
1757
2152
  ]
1758
2153
  }
1759
2154
  )
1760
2155
  ] });
1761
2156
  }
1762
- function Canvas2D({ width: e, height: t }) {
1763
- const r = useRef(null), { service: a, plots: o, view: n, animation: i } = useGraph(), l = 40;
1764
- return useEffect(() => {
1765
- const p = r.current, s = p == null ? void 0 : p.getContext("2d");
1766
- if (!p || !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)
1767
2162
  return;
1768
2163
  s.fillStyle = `rgb(${n.backgroundColor.r},${n.backgroundColor.g},${n.backgroundColor.b})`, s.fillRect(0, 0, e, t);
1769
- const d = e - l * 2, g = t - l * 2, y = (x) => l + (x - n.xRange.min) / (n.xRange.max - n.xRange.min) * d, h = (x) => t - l - (x - n.yRange.min) / (n.yRange.max - n.yRange.min) * g;
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;
1770
2165
  if (n.showGrid) {
1771
- s.strokeStyle = resolveCssColor("var(--nice-border, #e0e0e0)", s.canvas), s.lineWidth = 0.5;
1772
- for (let x = Math.ceil(n.xRange.min); x <= n.xRange.max; x++) {
1773
- const f = y(x);
1774
- s.beginPath(), s.moveTo(f, l), s.lineTo(f, t - l), 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();
1775
2170
  }
1776
- for (let x = Math.ceil(n.yRange.min); x <= n.yRange.max; x++) {
1777
- const f = h(x);
1778
- s.beginPath(), s.moveTo(l, f), s.lineTo(e - l, f), 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();
1779
2174
  }
1780
2175
  }
1781
2176
  if (n.showAxes) {
1782
- s.strokeStyle = resolveCssColor("var(--nice-text, #333)", s.canvas), s.lineWidth = 1;
1783
- const x = h(0);
1784
- s.beginPath(), s.moveTo(l, x), s.lineTo(e - l, x), s.stroke();
1785
- const f = y(0);
1786
- if (s.beginPath(), s.moveTo(f, l), s.lineTo(f, t - l), s.stroke(), n.showLabels) {
1787
- s.fillStyle = resolveCssColor("var(--nice-text, #333)", s.canvas), s.font = "12px sans-serif", s.textAlign = "center", s.fillText("x", e - l + 15, x + 4), s.fillText("y", f, l - 10), s.font = "10px sans-serif";
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";
1788
2183
  for (let c = Math.ceil(n.xRange.min); c <= n.xRange.max; c++)
1789
- c !== 0 && s.fillText(String(c), y(c), x + 15);
2184
+ c !== 0 && s.fillText(String(c), x(c), y + 15);
1790
2185
  for (let c = Math.ceil(n.yRange.min); c <= n.yRange.max; c++)
1791
- c !== 0 && (s.textAlign = "right", s.fillText(String(c), f - 5, h(c) + 4));
2186
+ c !== 0 && (s.textAlign = "right", s.fillText(String(c), b - 5, f(c) + 4));
1792
2187
  }
1793
2188
  }
1794
2189
  const w = i.isPlaying ? { [i.parameter]: i.currentValue } : {};
1795
- for (const x of o.filter((f) => f.visible)) {
1796
- const f = `rgb(${x.color.r},${x.color.g},${x.color.b})`;
1797
- s.strokeStyle = f, s.lineWidth = x.lineWidth || 2;
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;
1798
2193
  let c = [];
1799
- switch (x.type) {
2194
+ switch (y.type) {
1800
2195
  case "2d-function":
1801
- c = a.compute2DFunction(
1802
- x.expression,
2196
+ c = o.compute2DFunction(
2197
+ y.expression,
1803
2198
  n.xRange,
1804
- x.resolution || 200,
2199
+ y.resolution || 200,
1805
2200
  w
1806
2201
  );
1807
2202
  break;
1808
2203
  case "2d-parametric":
1809
- c = a.compute2DParametric(
1810
- x.expression,
1811
- x.expressionY || "sin(t)",
1812
- x.parameterRange || { min: 0, max: 2 * Math.PI },
1813
- x.resolution || 200,
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,
1814
2209
  w
1815
2210
  );
1816
2211
  break;
1817
2212
  case "2d-polar":
1818
- c = a.compute2DPolar(
1819
- x.expression,
1820
- x.parameterRange || { min: 0, max: 2 * Math.PI },
1821
- x.resolution || 200,
2213
+ c = o.compute2DPolar(
2214
+ y.expression,
2215
+ y.parameterRange || { min: 0, max: 2 * Math.PI },
2216
+ y.resolution || 200,
1822
2217
  w
1823
2218
  );
1824
2219
  break;
1825
2220
  }
1826
2221
  if (c.length > 0) {
1827
2222
  s.beginPath();
1828
- let u = !1;
1829
- for (const b of c) {
1830
- const k = y(b.x), m = h(b.y);
1831
- if (m < 0 || m > t) {
1832
- u = !1;
2223
+ let m = !1;
2224
+ for (const k of c) {
2225
+ const C = x(k.x), h = f(k.y);
2226
+ if (h < 0 || h > t) {
2227
+ m = !1;
1833
2228
  continue;
1834
2229
  }
1835
- u ? s.lineTo(k, m) : (s.moveTo(k, m), u = !0);
2230
+ m ? s.lineTo(C, h) : (s.moveTo(C, h), m = !0);
1836
2231
  }
1837
2232
  s.stroke();
1838
2233
  }
1839
2234
  }
1840
- }, [o, n, i, a, e, t]), /* @__PURE__ */ jsx("canvas", { ref: r, width: e, height: t, style: styles$2.canvas });
2235
+ }, [a, n, i, o, e, t]), /* @__PURE__ */ d("canvas", { ref: r, width: e, height: t, style: T.canvas });
1841
2236
  }
1842
- const UNITS = [
2237
+ const G = [
1843
2238
  // Length
1844
2239
  { name: "Meter", symbol: "m", category: "Length", toBase: (e) => e, fromBase: (e) => e },
1845
2240
  {
@@ -2109,12 +2504,12 @@ const UNITS = [
2109
2504
  fromBase: (e) => e / 1099511627776
2110
2505
  },
2111
2506
  { name: "Bit", symbol: "bit", category: "Data", toBase: (e) => e / 8, fromBase: (e) => e * 8 }
2112
- ], MatrixOps = {
2507
+ ], $ = {
2113
2508
  create(e, t, r = 0) {
2114
- const a = [];
2115
- for (let o = 0; o < e; o++)
2116
- a.push(new Array(t).fill(r));
2117
- return { rows: e, cols: t, data: a };
2509
+ const o = [];
2510
+ for (let a = 0; a < e; a++)
2511
+ o.push(new Array(t).fill(r));
2512
+ return { rows: e, cols: t, data: o };
2118
2513
  },
2119
2514
  identity(e) {
2120
2515
  const t = this.create(e, e);
@@ -2126,45 +2521,45 @@ const UNITS = [
2126
2521
  if (e.rows !== t.rows || e.cols !== t.cols)
2127
2522
  throw new Error("Matrix dimensions must match for addition");
2128
2523
  const r = this.create(e.rows, e.cols);
2129
- for (let a = 0; a < e.rows; a++)
2130
- for (let o = 0; o < e.cols; o++)
2131
- r.data[a][o] = e.data[a][o] + t.data[a][o];
2524
+ for (let o = 0; o < e.rows; o++)
2525
+ for (let a = 0; a < e.cols; a++)
2526
+ r.data[o][a] = e.data[o][a] + t.data[o][a];
2132
2527
  return r;
2133
2528
  },
2134
2529
  subtract(e, t) {
2135
2530
  if (e.rows !== t.rows || e.cols !== t.cols)
2136
2531
  throw new Error("Matrix dimensions must match for subtraction");
2137
2532
  const r = this.create(e.rows, e.cols);
2138
- for (let a = 0; a < e.rows; a++)
2139
- for (let o = 0; o < e.cols; o++)
2140
- r.data[a][o] = e.data[a][o] - t.data[a][o];
2533
+ for (let o = 0; o < e.rows; o++)
2534
+ for (let a = 0; a < e.cols; a++)
2535
+ r.data[o][a] = e.data[o][a] - t.data[o][a];
2141
2536
  return r;
2142
2537
  },
2143
2538
  multiply(e, t) {
2144
2539
  if (e.cols !== t.rows)
2145
2540
  throw new Error("Matrix A columns must equal Matrix B rows for multiplication");
2146
2541
  const r = this.create(e.rows, t.cols);
2147
- for (let a = 0; a < e.rows; a++)
2148
- for (let o = 0; o < t.cols; o++) {
2542
+ for (let o = 0; o < e.rows; o++)
2543
+ for (let a = 0; a < t.cols; a++) {
2149
2544
  let n = 0;
2150
2545
  for (let i = 0; i < e.cols; i++)
2151
- n += e.data[a][i] * t.data[i][o];
2152
- r.data[a][o] = n;
2546
+ n += e.data[o][i] * t.data[i][a];
2547
+ r.data[o][a] = n;
2153
2548
  }
2154
2549
  return r;
2155
2550
  },
2156
2551
  scalar(e, t) {
2157
2552
  const r = this.create(e.rows, e.cols);
2158
- for (let a = 0; a < e.rows; a++)
2159
- for (let o = 0; o < e.cols; o++)
2160
- r.data[a][o] = e.data[a][o] * t;
2553
+ for (let o = 0; o < e.rows; o++)
2554
+ for (let a = 0; a < e.cols; a++)
2555
+ r.data[o][a] = e.data[o][a] * t;
2161
2556
  return r;
2162
2557
  },
2163
2558
  transpose(e) {
2164
2559
  const t = this.create(e.cols, e.rows);
2165
2560
  for (let r = 0; r < e.rows; r++)
2166
- for (let a = 0; a < e.cols; a++)
2167
- t.data[a][r] = e.data[r][a];
2561
+ for (let o = 0; o < e.cols; o++)
2562
+ t.data[o][r] = e.data[r][o];
2168
2563
  return t;
2169
2564
  },
2170
2565
  determinant(e) {
@@ -2180,29 +2575,29 @@ const UNITS = [
2180
2575
  return t;
2181
2576
  },
2182
2577
  minor(e, t, r) {
2183
- const a = this.create(e.rows - 1, e.cols - 1);
2184
- let o = 0;
2578
+ const o = this.create(e.rows - 1, e.cols - 1);
2579
+ let a = 0;
2185
2580
  for (let n = 0; n < e.rows; n++) {
2186
2581
  if (n === t)
2187
2582
  continue;
2188
2583
  let i = 0;
2189
2584
  for (let l = 0; l < e.cols; l++)
2190
- l !== r && (a.data[o][i] = e.data[n][l], i++);
2191
- o++;
2585
+ l !== r && (o.data[a][i] = e.data[n][l], i++);
2586
+ a++;
2192
2587
  }
2193
- return a;
2588
+ return o;
2194
2589
  },
2195
2590
  inverse(e) {
2196
2591
  const t = this.determinant(e);
2197
2592
  if (t === 0)
2198
2593
  throw new Error("Matrix is singular, cannot compute inverse");
2199
- const r = e.rows, a = this.create(r, r);
2200
- for (let o = 0; o < r; o++)
2594
+ const r = e.rows, o = this.create(r, r);
2595
+ for (let a = 0; a < r; a++)
2201
2596
  for (let n = 0; n < r; n++) {
2202
- const i = Math.pow(-1, o + n), l = this.determinant(this.minor(e, o, n));
2203
- a.data[n][o] = i * l;
2597
+ const i = Math.pow(-1, a + n), l = this.determinant(this.minor(e, a, n));
2598
+ o.data[n][a] = i * l;
2204
2599
  }
2205
- return this.scalar(a, 1 / t);
2600
+ return this.scalar(o, 1 / t);
2206
2601
  },
2207
2602
  trace(e) {
2208
2603
  if (e.rows !== e.cols)
@@ -2215,17 +2610,17 @@ const UNITS = [
2215
2610
  eigenvalues2x2(e) {
2216
2611
  if (e.rows !== 2 || e.cols !== 2)
2217
2612
  throw new Error("Only 2x2 matrices supported for eigenvalues");
2218
- const t = e.data[0][0], r = e.data[0][1], a = e.data[1][0], o = e.data[1][1], n = t + o, i = t * o - r * a, l = n * n - 4 * i;
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;
2219
2614
  if (l < 0)
2220
2615
  throw new Error("Complex eigenvalues not supported");
2221
- const p = Math.sqrt(l);
2222
- return [(n + p) / 2, (n - p) / 2];
2616
+ const g = Math.sqrt(l);
2617
+ return [(n + g) / 2, (n - g) / 2];
2223
2618
  },
2224
2619
  toString(e, t = 4) {
2225
- return e.data.map((r) => "[ " + r.map((a) => a.toFixed(t).padStart(10)).join(" ") + " ]").join(`
2620
+ return e.data.map((r) => "[ " + r.map((o) => o.toFixed(t).padStart(10)).join(" ") + " ]").join(`
2226
2621
  `);
2227
2622
  }
2228
- }, CalculusOps = {
2623
+ }, te = {
2229
2624
  /** Numerical derivative at a point */
2230
2625
  derivative(e, t, r = 1e-7) {
2231
2626
  return (e(t + r) - e(t - r)) / (2 * r);
@@ -2235,27 +2630,27 @@ const UNITS = [
2235
2630
  return (e(t + r) - 2 * e(t) + e(t - r)) / (r * r);
2236
2631
  },
2237
2632
  /** Numerical integration using Simpson's rule */
2238
- integrate(e, t, r, a = 1e3) {
2239
- a % 2 !== 0 && a++;
2240
- const o = (r - t) / a;
2633
+ integrate(e, t, r, o = 1e3) {
2634
+ o % 2 !== 0 && o++;
2635
+ const a = (r - t) / o;
2241
2636
  let n = e(t) + e(r);
2242
- for (let i = 1; i < a; i++) {
2243
- const l = t + i * o;
2637
+ for (let i = 1; i < o; i++) {
2638
+ const l = t + i * a;
2244
2639
  n += i % 2 === 0 ? 2 * e(l) : 4 * e(l);
2245
2640
  }
2246
- return o / 3 * n;
2641
+ return a / 3 * n;
2247
2642
  },
2248
2643
  /** Find root using Newton-Raphson method */
2249
- findRoot(e, t, r = 1e-10, a = 100) {
2250
- let o = t;
2251
- for (let n = 0; n < a; n++) {
2252
- const i = e(o);
2644
+ findRoot(e, t, r = 1e-10, o = 100) {
2645
+ let a = t;
2646
+ for (let n = 0; n < o; n++) {
2647
+ const i = e(a);
2253
2648
  if (Math.abs(i) < r)
2254
- return o;
2255
- const l = this.derivative(e, o);
2649
+ return a;
2650
+ const l = this.derivative(e, a);
2256
2651
  if (l === 0)
2257
2652
  throw new Error("Derivative is zero, Newton-Raphson failed");
2258
- o = o - i / l;
2653
+ a = a - i / l;
2259
2654
  }
2260
2655
  throw new Error("Newton-Raphson did not converge");
2261
2656
  },
@@ -2267,13 +2662,13 @@ const UNITS = [
2267
2662
  return "1";
2268
2663
  const t = e.match(/^x\^(\d+)$/);
2269
2664
  if (t) {
2270
- const a = parseInt(t[1], 10);
2271
- return a === 1 ? "1" : a === 2 ? "2*x" : `${a}*x^${a - 1}`;
2665
+ const o = parseInt(t[1], 10);
2666
+ return o === 1 ? "1" : o === 2 ? "2*x" : `${o}*x^${o - 1}`;
2272
2667
  }
2273
2668
  const r = e.match(/^(-?\d+\.?\d*)\*x\^(\d+)$/);
2274
2669
  if (r) {
2275
- const a = parseFloat(r[1]), o = parseInt(r[2], 10), n = a * o;
2276
- return o === 1 ? String(n) : o === 2 ? `${n}*x` : `${n}*x^${o - 1}`;
2670
+ const o = parseFloat(r[1]), a = parseInt(r[2], 10), n = o * a;
2671
+ return a === 1 ? String(n) : a === 2 ? `${n}*x` : `${n}*x^${a - 1}`;
2277
2672
  }
2278
2673
  return e === "sin(x)" ? "cos(x)" : e === "cos(x)" ? "-sin(x)" : e === "e^x" || e === "exp(x)" ? "e^x" : e === "ln(x)" ? "1/x" : `d/dx(${e})`;
2279
2674
  },
@@ -2292,48 +2687,64 @@ const UNITS = [
2292
2687
  },
2293
2688
  /** Solve quadratic equation ax² + bx + c = 0 */
2294
2689
  solveQuadratic(e, t, r) {
2295
- const a = t * t - 4 * e * r;
2296
- if (a < 0)
2690
+ const o = t * t - 4 * e * r;
2691
+ if (o < 0)
2297
2692
  throw new Error("No real solutions (complex roots)");
2298
- if (a === 0)
2693
+ if (o === 0)
2299
2694
  return [-t / (2 * e)];
2300
- const o = Math.sqrt(a);
2301
- return [(-t + o) / (2 * e), (-t - o) / (2 * e)];
2695
+ const a = Math.sqrt(o);
2696
+ return [(-t + a) / (2 * e), (-t - a) / (2 * e)];
2302
2697
  }
2303
2698
  };
2304
- class CalculatorService {
2305
- constructor(e = {}) {
2306
- M(this, "history", []);
2307
- M(this, "memory", 0);
2308
- M(this, "variables", /* @__PURE__ */ new Map());
2309
- M(this, "config");
2699
+ class qe {
2700
+ constructor(t = {}) {
2701
+ z(this, "history", []);
2702
+ z(this, "memory", 0);
2703
+ z(this, "variables", /* @__PURE__ */ new Map());
2704
+ z(this, "config");
2310
2705
  this.config = {
2311
- precision: e.precision ?? 12,
2312
- angleUnit: e.angleUnit ?? "rad"
2706
+ precision: t.precision ?? 12,
2707
+ angleUnit: t.angleUnit ?? "rad"
2313
2708
  };
2314
2709
  }
2315
- /** Evaluate expression */
2316
- evaluate(expression) {
2317
- let expr = expression.replace(/π|pi/gi, String(Math.PI)).replace(/e(?![xp])/gi, String(Math.E)).replace(/\^/g, "**").replace(/√/g, "Math.sqrt").replace(/sin/gi, "Math.sin").replace(/cos/gi, "Math.cos").replace(/tan/gi, "Math.tan").replace(/asin/gi, "Math.asin").replace(/acos/gi, "Math.acos").replace(/atan/gi, "Math.atan").replace(/sinh/gi, "Math.sinh").replace(/cosh/gi, "Math.cosh").replace(/tanh/gi, "Math.tanh").replace(/log10/gi, "Math.log10").replace(/log2/gi, "Math.log2").replace(/ln/gi, "Math.log").replace(/log\b/gi, "Math.log10").replace(/exp/gi, "Math.exp").replace(/sqrt/gi, "Math.sqrt").replace(/cbrt/gi, "Math.cbrt").replace(/abs/gi, "Math.abs").replace(/floor/gi, "Math.floor").replace(/ceil/gi, "Math.ceil").replace(/round/gi, "Math.round").replace(/pow/gi, "Math.pow").replace(/min/gi, "Math.min").replace(/max/gi, "Math.max");
2318
- for (const [e, t] of this.variables)
2319
- expr = expr.replace(new RegExp(`\\b${e}\\b`, "g"), String(t));
2710
+ /**
2711
+ * Evaluate an expression — parsed by {@link ExpressionParser}, never run as code (until 1.2.0 a
2712
+ * chain of regex replacements fed `new Function`: `asin` came out as `aMath.sin`, `ceil` lost
2713
+ * its `e` to Euler's number, a result in exponent notation summed wrongly, and any text ran).
2714
+ * `log` is base 10 like the key, `ln` natural; trig functions follow `angleUnit`.
2715
+ */
2716
+ evaluate(t) {
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({
2718
+ strict: !0,
2719
+ ignoreCase: !0,
2720
+ functions: {
2721
+ log: Math.log10,
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))
2728
+ }
2729
+ });
2730
+ let i;
2320
2731
  try {
2321
- const result = eval(expr);
2322
- if (typeof result != "number" || !Number.isFinite(result))
2323
- throw new Error("Invalid result");
2324
- return result;
2325
- } catch (e) {
2326
- throw new Error(`Invalid expression: ${e.message}`);
2732
+ i = n.parse(t)(Object.fromEntries(this.variables));
2733
+ } catch (l) {
2734
+ throw new Error(`Invalid expression: ${l.message}`);
2327
2735
  }
2736
+ if (!Number.isFinite(i))
2737
+ throw new Error("Invalid expression: Invalid result");
2738
+ return i;
2328
2739
  }
2329
2740
  /** Add to history */
2330
- addHistory(e, t, r) {
2741
+ addHistory(t, r, o) {
2331
2742
  this.history.unshift({
2332
2743
  id: Date.now().toString(36),
2333
- expression: e,
2334
- result: t,
2744
+ expression: t,
2745
+ result: r,
2335
2746
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2336
- mode: r
2747
+ mode: o
2337
2748
  }), this.history.length > 100 && this.history.pop();
2338
2749
  }
2339
2750
  /** Get history */
@@ -2345,67 +2756,67 @@ class CalculatorService {
2345
2756
  this.history = [];
2346
2757
  }
2347
2758
  /** Memory operations */
2348
- memoryStore(e) {
2349
- this.memory = e;
2759
+ memoryStore(t) {
2760
+ this.memory = t;
2350
2761
  }
2351
2762
  memoryRecall() {
2352
2763
  return this.memory;
2353
2764
  }
2354
- memoryAdd(e) {
2355
- this.memory += e;
2765
+ memoryAdd(t) {
2766
+ this.memory += t;
2356
2767
  }
2357
2768
  memoryClear() {
2358
2769
  this.memory = 0;
2359
2770
  }
2360
2771
  /** Variable operations */
2361
- setVariable(e, t) {
2362
- this.variables.set(e, t);
2772
+ setVariable(t, r) {
2773
+ this.variables.set(t, r);
2363
2774
  }
2364
- getVariable(e) {
2365
- return this.variables.get(e);
2775
+ getVariable(t) {
2776
+ return this.variables.get(t);
2366
2777
  }
2367
2778
  /** Convert between number bases */
2368
- convertBase(e, t, r) {
2369
- const a = { BIN: 2, OCT: 8, DEC: 10, HEX: 16 }, o = parseInt(e, a[t]);
2370
- if (isNaN(o))
2779
+ convertBase(t, r, o) {
2780
+ const a = { BIN: 2, OCT: 8, DEC: 10, HEX: 16 }, n = parseInt(t, a[r]);
2781
+ if (isNaN(n))
2371
2782
  throw new Error("Invalid number for base conversion");
2372
- return o.toString(a[r]).toUpperCase();
2783
+ return n.toString(a[o]).toUpperCase();
2373
2784
  }
2374
2785
  /** Convert units */
2375
- convertUnits(e, t, r) {
2376
- const a = UNITS.find((i) => i.symbol === t), o = UNITS.find((i) => i.symbol === r);
2377
- if (!a || !o)
2786
+ convertUnits(t, r, o) {
2787
+ const a = G.find((l) => l.symbol === r), n = G.find((l) => l.symbol === o);
2788
+ if (!a || !n)
2378
2789
  throw new Error("Unknown unit");
2379
- if (a.category !== o.category)
2790
+ if (a.category !== n.category)
2380
2791
  throw new Error("Cannot convert between different unit categories");
2381
- const n = a.toBase(e);
2382
- return o.fromBase(n);
2792
+ const i = a.toBase(t);
2793
+ return n.fromBase(i);
2383
2794
  }
2384
2795
  /** Get units by category */
2385
- getUnitsByCategory(e) {
2386
- return UNITS.filter((t) => t.category === e);
2796
+ getUnitsByCategory(t) {
2797
+ return G.filter((r) => r.category === t);
2387
2798
  }
2388
2799
  /** Get all unit categories */
2389
2800
  getUnitCategories() {
2390
- return [...new Set(UNITS.map((e) => e.category))];
2801
+ return [...new Set(G.map((t) => t.category))];
2391
2802
  }
2392
2803
  /** Format number with precision */
2393
- format(e) {
2394
- const t = this.config.precision;
2395
- return Math.abs(e) < 1e-10 ? "0" : Math.abs(e) > 1e10 || Math.abs(e) < 1e-6 ? e.toExponential(t) : parseFloat(e.toPrecision(t)).toString();
2804
+ format(t) {
2805
+ const r = this.config.precision;
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();
2396
2807
  }
2397
2808
  }
2398
- function createCalculatorService(e) {
2399
- return new CalculatorService(e);
2809
+ function nt(e) {
2810
+ return new qe(e);
2400
2811
  }
2401
- const CalculatorContext = createContext(null);
2402
- function useCalculator() {
2403
- const e = useContext(CalculatorContext);
2812
+ const de = /* @__PURE__ */ O(null);
2813
+ function X() {
2814
+ const e = F(de);
2404
2815
  if (!e)
2405
2816
  throw new Error("useCalculator must be used within CalculatorProvider");
2406
2817
  return e;
2407
2818
  }
2408
- const styles$1 = {
2819
+ const B = {
2409
2820
  container: {
2410
2821
  width: "400px",
2411
2822
  fontFamily: "'Inter', sans-serif",
@@ -2460,114 +2871,115 @@ const styles$1 = {
2460
2871
  color: "var(--nice-text, #000)"
2461
2872
  },
2462
2873
  keyFunction: {
2463
- backgroundColor: "#505050"
2874
+ backgroundColor: "var(--nice-bg-tertiary, #505050)"
2464
2875
  }
2465
2876
  };
2466
- function NiceCalculator({
2877
+ function it({
2467
2878
  service: e,
2468
2879
  className: t,
2469
2880
  style: r
2470
2881
  }) {
2471
- const [a, o] = useState("0"), [n, i] = useState("standard"), [l, p] = useState([]), [s, d] = useState(!1), g = useCallback(
2472
- (x) => {
2473
- s && /[0-9.]/.test(x) ? (o(x), d(!1)) : (o((f) => f === "0" && x !== "." ? x : f + x), d(!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));
2474
2885
  },
2475
2886
  [s]
2476
- ), y = useCallback(() => {
2477
- o("0"), d(!1);
2478
- }, []), h = useCallback(() => {
2887
+ ), x = R(() => {
2888
+ a("0"), p(!1);
2889
+ }, []), f = R(() => {
2479
2890
  try {
2480
- const x = e.evaluate(a), f = e.format(x);
2481
- e.addHistory(a, f, n), p(e.getHistory()), o(f), d(!0);
2891
+ const y = e.evaluate(o), b = e.format(y);
2892
+ e.addHistory(o, b, n), g(e.getHistory()), a(b), p(!0);
2482
2893
  } catch {
2483
- o("Error"), d(!0);
2894
+ a("Error"), p(!0);
2484
2895
  }
2485
- }, [a, n, e]), w = {
2896
+ }, [o, n, e]), w = {
2486
2897
  service: e,
2487
- display: a,
2488
- setDisplay: o,
2898
+ display: o,
2899
+ setDisplay: a,
2489
2900
  mode: n,
2490
2901
  setMode: i,
2491
2902
  history: l,
2492
- calculate: h,
2493
- appendDigit: g,
2494
- clear: y
2903
+ calculate: f,
2904
+ appendDigit: u,
2905
+ clear: x
2495
2906
  };
2496
- return /* @__PURE__ */ jsx(CalculatorContext.Provider, { value: w, children: /* @__PURE__ */ jsxs("div", { className: t, style: { ...styles$1.container, ...r }, children: [
2497
- /* @__PURE__ */ jsx(ModeSelector, {}),
2498
- /* @__PURE__ */ jsx(Display, {}),
2499
- n === "standard" && /* @__PURE__ */ jsx(StandardKeypad, {}),
2500
- n === "scientific" && /* @__PURE__ */ jsx(ScientificKeypad, {}),
2501
- n === "programmer" && /* @__PURE__ */ jsx(ProgrammerKeypad, {}),
2502
- n === "matrix" && /* @__PURE__ */ jsx(MatrixMode, {}),
2503
- n === "calculus" && /* @__PURE__ */ jsx(CalculusMode, {}),
2504
- n === "units" && /* @__PURE__ */ jsx(UnitsMode, {})
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, {})
2505
2916
  ] }) });
2506
2917
  }
2507
- function ModeSelector() {
2508
- const { mode: e, setMode: t } = useCalculator(), r = [
2509
- { id: "standard", label: "Standard" },
2510
- { id: "scientific", label: "Scientific" },
2511
- { id: "programmer", label: "Programmer" },
2512
- { id: "matrix", label: "Matrix" },
2513
- { id: "calculus", label: "Calculus" },
2514
- { 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") }
2515
2926
  ];
2516
- return /* @__PURE__ */ jsx("div", { style: styles$1.modeSelector, children: r.map((a) => /* @__PURE__ */ jsx(
2927
+ return /* @__PURE__ */ d("div", { style: B.modeSelector, children: o.map((a) => /* @__PURE__ */ d(
2517
2928
  "button",
2518
2929
  {
2519
- onClick: () => t(a.id),
2930
+ onClick: () => r(a.id),
2520
2931
  style: {
2521
- ...styles$1.modeButton,
2522
- backgroundColor: e === a.id ? "var(--nice-primary-hover, #1976d2)" : "transparent",
2523
- color: e === a.id ? "var(--nice-color-white, #fff)" : "var(--nice-text-secondary, #888)"
2932
+ ...B.modeButton,
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)"
2524
2935
  },
2525
2936
  children: a.label
2526
2937
  },
2527
2938
  a.id
2528
2939
  )) });
2529
2940
  }
2530
- function Display() {
2531
- const { display: e } = useCalculator();
2532
- return /* @__PURE__ */ jsx("div", { style: styles$1.display, children: /* @__PURE__ */ jsx("div", { style: styles$1.displayText, children: e }) });
2941
+ function Ne() {
2942
+ const { display: e } = X();
2943
+ return /* @__PURE__ */ d("div", { style: B.display, children: /* @__PURE__ */ d("div", { style: B.displayText, children: e }) });
2533
2944
  }
2534
- function StandardKeypad() {
2535
- const { appendDigit: e, clear: t, calculate: r, setDisplay: a, display: o } = useCalculator(), n = [
2536
- { label: "AC", action: t, style: styles$1.keyFunction },
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
2948
+ { label: "AC", action: t, style: B.keyFunction },
2537
2949
  {
2538
2950
  label: "±",
2539
- action: () => a(o.startsWith("-") ? o.slice(1) : "-" + o),
2540
- style: styles$1.keyFunction
2951
+ action: () => o(a.startsWith("-") ? a.slice(1) : "-" + a),
2952
+ style: B.keyFunction
2541
2953
  },
2542
- { label: "%", action: () => e("/100"), style: styles$1.keyFunction },
2543
- { label: "÷", action: () => e("/"), style: styles$1.keyOperator },
2954
+ { label: "%", action: () => e("/100"), style: B.keyFunction },
2955
+ { label: "÷", action: () => e("/"), style: B.keyOperator },
2544
2956
  { label: "7", action: () => e("7") },
2545
2957
  { label: "8", action: () => e("8") },
2546
2958
  { label: "9", action: () => e("9") },
2547
- { label: "×", action: () => e("*"), style: styles$1.keyOperator },
2959
+ { label: "×", action: () => e("*"), style: B.keyOperator },
2548
2960
  { label: "4", action: () => e("4") },
2549
2961
  { label: "5", action: () => e("5") },
2550
2962
  { label: "6", action: () => e("6") },
2551
- { label: "−", action: () => e("-"), style: styles$1.keyOperator },
2963
+ { label: "−", action: () => e("-"), style: B.keyOperator },
2552
2964
  { label: "1", action: () => e("1") },
2553
2965
  { label: "2", action: () => e("2") },
2554
2966
  { label: "3", action: () => e("3") },
2555
- { label: "+", action: () => e("+"), style: styles$1.keyOperator },
2967
+ { label: "+", action: () => e("+"), style: B.keyOperator },
2556
2968
  { label: "0", action: () => e("0") },
2557
2969
  { label: ".", action: () => e(".") },
2558
- { label: "⌫", action: () => a(o.length > 1 ? o.slice(0, -1) : "0") },
2559
- { label: "=", action: r, style: styles$1.keyOperator }
2970
+ { label: "⌫", action: () => o(a.length > 1 ? a.slice(0, -1) : "0") },
2971
+ { label: "=", action: r, style: B.keyOperator }
2560
2972
  ];
2561
- return /* @__PURE__ */ jsx("div", { style: styles$1.keypad, children: n.map((i, l) => /* @__PURE__ */ jsx("button", { onClick: i.action, style: { ...styles$1.key, ...i.style || {} }, children: i.label }, l)) });
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)) });
2562
2974
  }
2563
- function ScientificKeypad() {
2975
+ function je() {
2564
2976
  const {
2565
2977
  appendDigit: e,
2566
2978
  clear: t,
2567
2979
  calculate: r,
2568
- setDisplay: a,
2569
- display: o
2570
- } = useCalculator(), n = [
2980
+ setDisplay: o,
2981
+ display: a
2982
+ } = X(), n = [
2571
2983
  { label: "sin", action: () => e("sin(") },
2572
2984
  { label: "cos", action: () => e("cos(") },
2573
2985
  { label: "tan", action: () => e("tan(") },
@@ -2576,40 +2988,43 @@ function ScientificKeypad() {
2576
2988
  ], i = [
2577
2989
  { label: "x²", action: () => e("^2") },
2578
2990
  { label: "x³", action: () => e("^3") },
2991
+ // audit-allow: i18n — math notation
2579
2992
  { label: "xʸ", action: () => e("^") },
2580
2993
  { label: "√", action: () => e("sqrt(") },
2994
+ // audit-allow: i18n — math notation
2581
2995
  { label: "eˣ", action: () => e("exp(") }
2582
2996
  ], l = [
2583
2997
  { label: "(", action: () => e("(") },
2584
2998
  { label: ")", action: () => e(")") },
2585
2999
  { label: "π", action: () => e("π") },
2586
3000
  { label: "e", action: () => e("e") },
3001
+ // audit-allow: i18n — the calculator key, the same in every language
2587
3002
  { label: "AC", action: t }
2588
3003
  ];
2589
- return /* @__PURE__ */ jsxs("div", { children: [
2590
- /* @__PURE__ */ jsx("div", { style: { ...styles$1.keypad, gridTemplateColumns: "repeat(5, 1fr)" }, children: [...n, ...i, ...l].map((p, s) => /* @__PURE__ */ jsx(
3004
+ return /* @__PURE__ */ v("div", { children: [
3005
+ /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(5, 1fr)" }, children: [...n, ...i, ...l].map((g, s) => /* @__PURE__ */ d(
2591
3006
  "button",
2592
3007
  {
2593
- onClick: p.action,
2594
- style: { ...styles$1.key, ...styles$1.keyFunction, padding: "12px" },
2595
- children: p.label
3008
+ onClick: g.action,
3009
+ style: { ...B.key, ...B.keyFunction, padding: "12px" },
3010
+ children: g.label
2596
3011
  },
2597
3012
  s
2598
3013
  )) }),
2599
- /* @__PURE__ */ jsx(StandardKeypad, {})
3014
+ /* @__PURE__ */ d(pe, {})
2600
3015
  ] });
2601
3016
  }
2602
- function ProgrammerKeypad() {
2603
- const { display: e, setDisplay: t, service: r } = useCalculator(), [a, o] = useState("DEC"), n = (l) => {
3017
+ function Fe() {
3018
+ const { display: e, setDisplay: t, service: r } = X(), [o, a] = M("DEC"), n = (l) => {
2604
3019
  try {
2605
- const p = r.convertBase(e, a, l);
2606
- t(p), o(l);
3020
+ const g = r.convertBase(e, o, l);
3021
+ t(g), a(l);
2607
3022
  } catch {
2608
3023
  t("Error");
2609
3024
  }
2610
- }, i = a === "HEX" ? ["A", "B", "C", "D", "E", "F"] : [];
2611
- return /* @__PURE__ */ jsxs("div", { children: [
2612
- /* @__PURE__ */ jsx(
3025
+ }, i = o === "HEX" ? ["A", "B", "C", "D", "E", "F"] : [];
3026
+ return /* @__PURE__ */ v("div", { children: [
3027
+ /* @__PURE__ */ d(
2613
3028
  "div",
2614
3029
  {
2615
3030
  style: {
@@ -2618,7 +3033,7 @@ function ProgrammerKeypad() {
2618
3033
  padding: "8px",
2619
3034
  backgroundColor: "var(--nice-bg-secondary, #252525)"
2620
3035
  },
2621
- children: ["BIN", "OCT", "DEC", "HEX"].map((l) => /* @__PURE__ */ jsx(
3036
+ children: ["BIN", "OCT", "DEC", "HEX"].map((l) => /* @__PURE__ */ d(
2622
3037
  "button",
2623
3038
  {
2624
3039
  onClick: () => n(l),
@@ -2627,7 +3042,7 @@ function ProgrammerKeypad() {
2627
3042
  padding: "8px",
2628
3043
  border: "none",
2629
3044
  borderRadius: "4px",
2630
- backgroundColor: a === l ? "var(--nice-primary-hover, #1976d2)" : "var(--nice-border, #3c3c3c)",
3045
+ backgroundColor: o === l ? "var(--nice-primary-hover, #1976d2)" : "var(--nice-border, #3c3c3c)",
2631
3046
  color: "var(--nice-color-white, #fff)",
2632
3047
  cursor: "pointer"
2633
3048
  },
@@ -2637,16 +3052,16 @@ function ProgrammerKeypad() {
2637
3052
  ))
2638
3053
  }
2639
3054
  ),
2640
- i.length > 0 && /* @__PURE__ */ jsx("div", { style: { ...styles$1.keypad, gridTemplateColumns: "repeat(6, 1fr)" }, children: i.map((l) => /* @__PURE__ */ jsx(
3055
+ i.length > 0 && /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(6, 1fr)" }, children: i.map((l) => /* @__PURE__ */ d(
2641
3056
  "button",
2642
3057
  {
2643
3058
  onClick: () => t(e === "0" ? l : e + l),
2644
- style: styles$1.key,
3059
+ style: B.key,
2645
3060
  children: l
2646
3061
  },
2647
3062
  l
2648
3063
  )) }),
2649
- /* @__PURE__ */ jsx("div", { style: { ...styles$1.keypad, gridTemplateColumns: "repeat(4, 1fr)" }, children: [
3064
+ /* @__PURE__ */ d("div", { style: { ...B.keypad, gridTemplateColumns: "repeat(4, 1fr)" }, children: [
2650
3065
  "7",
2651
3066
  "8",
2652
3067
  "9",
@@ -2664,12 +3079,12 @@ function ProgrammerKeypad() {
2664
3079
  "<<",
2665
3080
  ">>"
2666
3081
  ].map((l) => {
2667
- const p = ["AND", "OR", "XOR", "NOT", "<<", ">>"].includes(l);
2668
- return /* @__PURE__ */ jsx(
3082
+ const g = ["AND", "OR", "XOR", "NOT", "<<", ">>"].includes(l);
3083
+ return /* @__PURE__ */ d(
2669
3084
  "button",
2670
3085
  {
2671
3086
  onClick: () => t(e === "0" ? l : e + l),
2672
- style: { ...styles$1.key, ...p ? styles$1.keyFunction : {} },
3087
+ style: { ...B.key, ...g ? B.keyFunction : {} },
2673
3088
  children: l
2674
3089
  },
2675
3090
  l
@@ -2677,49 +3092,51 @@ function ProgrammerKeypad() {
2677
3092
  }) })
2678
3093
  ] });
2679
3094
  }
2680
- function MatrixMode() {
2681
- const { t: e } = useNiceTranslation(), [t, r] = useState(MatrixOps.create(2, 2)), [a, o] = useState(MatrixOps.create(2, 2)), [n, i] = useState(""), l = (s, d, g, y, h) => {
2682
- const w = { ...s, data: s.data.map((x) => [...x]) };
2683
- w.data[g][y] = parseFloat(h) || 0, d(w);
2684
- }, p = [
2685
- { label: "A + B", fn: () => MatrixOps.toString(MatrixOps.add(t, a)) },
2686
- { label: "A - B", fn: () => MatrixOps.toString(MatrixOps.subtract(t, a)) },
2687
- { label: "A × B", fn: () => MatrixOps.toString(MatrixOps.multiply(t, a)) },
2688
- { label: "det(A)", fn: () => MatrixOps.determinant(t).toFixed(4) },
2689
- { label: "Aᵀ", fn: () => MatrixOps.toString(MatrixOps.transpose(t)) },
2690
- { label: "A⁻¹", fn: () => MatrixOps.toString(MatrixOps.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)) }
2691
3108
  ];
2692
- return /* @__PURE__ */ jsxs("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2693
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "12px", marginBottom: "12px" }, children: [
2694
- /* @__PURE__ */ jsxs("div", { children: [
2695
- /* @__PURE__ */ jsx("div", { style: { color: "var(--nice-text-secondary, #888)", marginBottom: "4px" }, children: e("calculator.matrixA", "Matrix A") }),
2696
- /* @__PURE__ */ jsx(
2697
- MatrixInput,
3109
+ return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
3110
+ /* @__PURE__ */ v("div", { style: { display: "flex", gap: "12px", marginBottom: "12px" }, children: [
3111
+ /* @__PURE__ */ v("div", { children: [
3112
+ /* @__PURE__ */ d("div", { style: { color: "var(--nice-text-secondary, #888)", marginBottom: "4px" }, children: e("calculator.matrixA", "Matrix A") }),
3113
+ /* @__PURE__ */ d(
3114
+ re,
2698
3115
  {
2699
3116
  matrix: t,
2700
- onChange: (s, d, g) => l(t, r, s, d, g)
3117
+ onChange: (s, p, u) => l(t, r, s, p, u)
2701
3118
  }
2702
3119
  )
2703
3120
  ] }),
2704
- /* @__PURE__ */ jsxs("div", { children: [
2705
- /* @__PURE__ */ jsx("div", { style: { color: "var(--nice-text-secondary, #888)", marginBottom: "4px" }, children: e("calculator.matrixB", "Matrix B") }),
2706
- /* @__PURE__ */ jsx(
2707
- MatrixInput,
3121
+ /* @__PURE__ */ v("div", { children: [
3122
+ /* @__PURE__ */ d("div", { style: { color: "var(--nice-text-secondary, #888)", marginBottom: "4px" }, children: e("calculator.matrixB", "Matrix B") }),
3123
+ /* @__PURE__ */ d(
3124
+ re,
2708
3125
  {
2709
- matrix: a,
2710
- onChange: (s, d, g) => l(a, o, s, d, g)
3126
+ matrix: o,
3127
+ onChange: (s, p, u) => l(o, a, s, p, u)
2711
3128
  }
2712
3129
  )
2713
3130
  ] })
2714
3131
  ] }),
2715
- /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap", marginBottom: "12px" }, children: p.map((s) => /* @__PURE__ */ jsx(
3132
+ /* @__PURE__ */ d("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap", marginBottom: "12px" }, children: g.map((s) => /* @__PURE__ */ d(
2716
3133
  "button",
2717
3134
  {
2718
3135
  onClick: () => {
2719
3136
  try {
2720
3137
  i(s.fn());
2721
- } catch (d) {
2722
- i(d.message);
3138
+ } catch (p) {
3139
+ i(p.message);
2723
3140
  }
2724
3141
  },
2725
3142
  style: {
@@ -2734,7 +3151,7 @@ function MatrixMode() {
2734
3151
  },
2735
3152
  s.label
2736
3153
  )) }),
2737
- n && /* @__PURE__ */ jsx(
3154
+ n && /* @__PURE__ */ d(
2738
3155
  "pre",
2739
3156
  {
2740
3157
  style: {
@@ -2747,21 +3164,21 @@ function MatrixMode() {
2747
3164
  )
2748
3165
  ] });
2749
3166
  }
2750
- function MatrixInput({
3167
+ function re({
2751
3168
  matrix: e,
2752
3169
  onChange: t
2753
3170
  }) {
2754
- return /* @__PURE__ */ jsx(
3171
+ return /* @__PURE__ */ d(
2755
3172
  "div",
2756
3173
  {
2757
3174
  style: { display: "grid", gridTemplateColumns: `repeat(${e.cols}, 50px)`, gap: "4px" },
2758
3175
  children: e.data.map(
2759
- (r, a) => r.map((o, n) => /* @__PURE__ */ jsx(
3176
+ (r, o) => r.map((a, n) => /* @__PURE__ */ d(
2760
3177
  "input",
2761
3178
  {
2762
3179
  type: "number",
2763
- value: o,
2764
- onChange: (i) => t(a, n, i.target.value),
3180
+ value: a,
3181
+ onChange: (i) => t(o, n, i.target.value),
2765
3182
  style: {
2766
3183
  width: "100%",
2767
3184
  padding: "4px",
@@ -2772,16 +3189,16 @@ function MatrixInput({
2772
3189
  borderRadius: "4px"
2773
3190
  }
2774
3191
  },
2775
- `${a}-${n}`
3192
+ `${o}-${n}`
2776
3193
  ))
2777
3194
  )
2778
3195
  }
2779
3196
  );
2780
3197
  }
2781
- function CalculusMode() {
2782
- const { t: e } = useNiceTranslation(), [t, r] = useState("x^2"), [a, o] = useState("");
2783
- return /* @__PURE__ */ jsxs("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2784
- /* @__PURE__ */ jsx(
3198
+ function Ge() {
3199
+ const { t: e } = E(), [t, r] = M("x^2"), [o, a] = M("");
3200
+ return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
3201
+ /* @__PURE__ */ d(
2785
3202
  "input",
2786
3203
  {
2787
3204
  type: "text",
@@ -2799,11 +3216,11 @@ function CalculusMode() {
2799
3216
  }
2800
3217
  }
2801
3218
  ),
2802
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap", marginBottom: "12px" }, children: [
2803
- /* @__PURE__ */ jsx(
3219
+ /* @__PURE__ */ v("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap", marginBottom: "12px" }, children: [
3220
+ /* @__PURE__ */ d(
2804
3221
  "button",
2805
3222
  {
2806
- onClick: () => o(`d/dx(${t}) = ${CalculusOps.symbolicDerivative(t)}`),
3223
+ onClick: () => a(`d/dx(${t}) = ${te.symbolicDerivative(t)}`),
2807
3224
  style: {
2808
3225
  padding: "8px 12px",
2809
3226
  backgroundColor: "var(--nice-success, #4caf50)",
@@ -2815,10 +3232,10 @@ function CalculusMode() {
2815
3232
  children: e("calculator.differentiate", "Differentiate")
2816
3233
  }
2817
3234
  ),
2818
- /* @__PURE__ */ jsx(
3235
+ /* @__PURE__ */ d(
2819
3236
  "button",
2820
3237
  {
2821
- onClick: () => o(`∫(${t})dx = ${CalculusOps.symbolicIntegral(t)}`),
3238
+ onClick: () => a(`∫(${t})dx = ${te.symbolicIntegral(t)}`),
2822
3239
  style: {
2823
3240
  padding: "8px 12px",
2824
3241
  backgroundColor: "var(--nice-primary, #2196f3)",
@@ -2831,7 +3248,7 @@ function CalculusMode() {
2831
3248
  }
2832
3249
  )
2833
3250
  ] }),
2834
- a && /* @__PURE__ */ jsx(
3251
+ o && /* @__PURE__ */ d(
2835
3252
  "div",
2836
3253
  {
2837
3254
  style: {
@@ -2841,29 +3258,29 @@ function CalculusMode() {
2841
3258
  backgroundColor: "var(--nice-bg, #1e1e1e)",
2842
3259
  borderRadius: "4px"
2843
3260
  },
2844
- children: a
3261
+ children: o
2845
3262
  }
2846
3263
  )
2847
3264
  ] });
2848
3265
  }
2849
- function UnitsMode() {
2850
- const { t: e } = useNiceTranslation(), { service: t } = useCalculator(), [r, a] = useState("1"), [o, n] = useState("m"), [i, l] = useState("ft"), [p, s] = useState("Length"), [d, g] = useState(""), y = t.getUnitCategories(), h = t.getUnitsByCategory(p), w = () => {
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 = () => {
2851
3268
  try {
2852
- const x = t.convertUnits(parseFloat(r), o, i);
2853
- g(`${r} ${o} = ${t.format(x)} ${i}`);
2854
- } catch (x) {
2855
- g(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);
2856
3273
  }
2857
3274
  };
2858
- return /* @__PURE__ */ jsxs("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
2859
- /* @__PURE__ */ jsx(
3275
+ return /* @__PURE__ */ v("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
3276
+ /* @__PURE__ */ d(
2860
3277
  "select",
2861
3278
  {
2862
- value: p,
2863
- onChange: (x) => {
2864
- s(x.target.value);
2865
- const f = t.getUnitsByCategory(x.target.value);
2866
- f.length >= 2 && (n(f[0].symbol), l(f[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));
2867
3284
  },
2868
3285
  style: {
2869
3286
  width: "100%",
@@ -2874,16 +3291,16 @@ function UnitsMode() {
2874
3291
  border: "1px solid var(--nice-border-color, #555)",
2875
3292
  borderRadius: "4px"
2876
3293
  },
2877
- children: y.map((x) => /* @__PURE__ */ jsx("option", { value: x, children: x }, x))
3294
+ children: x.map((y) => /* @__PURE__ */ d("option", { value: y, children: y }, y))
2878
3295
  }
2879
3296
  ),
2880
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }, children: [
2881
- /* @__PURE__ */ jsx(
3297
+ /* @__PURE__ */ v("div", { style: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }, children: [
3298
+ /* @__PURE__ */ d(
2882
3299
  "input",
2883
3300
  {
2884
3301
  type: "number",
2885
3302
  value: r,
2886
- onChange: (x) => a(x.target.value),
3303
+ onChange: (y) => o(y.target.value),
2887
3304
  style: {
2888
3305
  flex: 1,
2889
3306
  padding: "8px",
@@ -2894,11 +3311,11 @@ function UnitsMode() {
2894
3311
  }
2895
3312
  }
2896
3313
  ),
2897
- /* @__PURE__ */ jsx(
3314
+ /* @__PURE__ */ d(
2898
3315
  "select",
2899
3316
  {
2900
- value: o,
2901
- onChange: (x) => n(x.target.value),
3317
+ value: a,
3318
+ onChange: (y) => n(y.target.value),
2902
3319
  style: {
2903
3320
  padding: "8px",
2904
3321
  backgroundColor: "var(--nice-border, #3c3c3c)",
@@ -2906,22 +3323,22 @@ function UnitsMode() {
2906
3323
  border: "1px solid var(--nice-border-color, #555)",
2907
3324
  borderRadius: "4px"
2908
3325
  },
2909
- children: h.map((x) => /* @__PURE__ */ jsxs("option", { value: x.symbol, children: [
2910
- x.name,
3326
+ children: f.map((y) => /* @__PURE__ */ v("option", { value: y.symbol, children: [
3327
+ y.name,
2911
3328
  " (",
2912
- x.symbol,
3329
+ y.symbol,
2913
3330
  ")"
2914
- ] }, x.symbol))
3331
+ ] }, y.symbol))
2915
3332
  }
2916
3333
  )
2917
3334
  ] }),
2918
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }, children: [
2919
- /* @__PURE__ */ jsx("span", { style: { color: "var(--nice-text-secondary, #888)" }, children: "→" }),
2920
- /* @__PURE__ */ jsx(
3335
+ /* @__PURE__ */ v("div", { style: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }, children: [
3336
+ /* @__PURE__ */ d("span", { style: { color: "var(--nice-text-secondary, #888)" }, children: /* @__PURE__ */ d(j, { name: "arrow-right", size: 12 }) }),
3337
+ /* @__PURE__ */ d(
2921
3338
  "select",
2922
3339
  {
2923
3340
  value: i,
2924
- onChange: (x) => l(x.target.value),
3341
+ onChange: (y) => l(y.target.value),
2925
3342
  style: {
2926
3343
  flex: 1,
2927
3344
  padding: "8px",
@@ -2930,16 +3347,16 @@ function UnitsMode() {
2930
3347
  border: "1px solid var(--nice-border-color, #555)",
2931
3348
  borderRadius: "4px"
2932
3349
  },
2933
- children: h.map((x) => /* @__PURE__ */ jsxs("option", { value: x.symbol, children: [
2934
- x.name,
3350
+ children: f.map((y) => /* @__PURE__ */ v("option", { value: y.symbol, children: [
3351
+ y.name,
2935
3352
  " (",
2936
- x.symbol,
3353
+ y.symbol,
2937
3354
  ")"
2938
- ] }, x.symbol))
3355
+ ] }, y.symbol))
2939
3356
  }
2940
3357
  )
2941
3358
  ] }),
2942
- /* @__PURE__ */ jsx(
3359
+ /* @__PURE__ */ d(
2943
3360
  "button",
2944
3361
  {
2945
3362
  onClick: w,
@@ -2956,7 +3373,7 @@ function UnitsMode() {
2956
3373
  children: e("calculator.convert", "Convert")
2957
3374
  }
2958
3375
  ),
2959
- d && /* @__PURE__ */ jsx(
3376
+ p && /* @__PURE__ */ d(
2960
3377
  "div",
2961
3378
  {
2962
3379
  style: {
@@ -2965,12 +3382,12 @@ function UnitsMode() {
2965
3382
  fontSize: "18px",
2966
3383
  textAlign: "center"
2967
3384
  },
2968
- children: d
3385
+ children: p
2969
3386
  }
2970
3387
  )
2971
3388
  ] });
2972
3389
  }
2973
- const GeoMath = {
3390
+ const I = {
2974
3391
  /** Distance between two points */
2975
3392
  distance(e, t) {
2976
3393
  return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
@@ -2981,8 +3398,8 @@ const GeoMath = {
2981
3398
  },
2982
3399
  /** Angle between three points (vertex at p2) */
2983
3400
  angle(e, t, r) {
2984
- const a = Math.atan2(e.y - t.y, e.x - t.x);
2985
- let n = Math.atan2(r.y - t.y, r.x - t.x) - a;
3401
+ const o = Math.atan2(e.y - t.y, e.x - t.x);
3402
+ let n = Math.atan2(r.y - t.y, r.x - t.x) - o;
2986
3403
  return n < 0 && (n += 2 * Math.PI), n;
2987
3404
  },
2988
3405
  /** Angle in degrees */
@@ -2991,79 +3408,79 @@ const GeoMath = {
2991
3408
  },
2992
3409
  /** Point on line closest to given point */
2993
3410
  closestPointOnLine(e, t, r) {
2994
- const a = t.x - e.x, o = t.y - e.y, n = ((r.x - e.x) * a + (r.y - e.y) * o) / (a * a + o * o);
2995
- return { x: e.x + n * a, y: e.y + n * o };
3411
+ const o = t.x - e.x, a = t.y - e.y, n = ((r.x - e.x) * o + (r.y - e.y) * a) / (o * o + a * a);
3412
+ return { x: e.x + n * o, y: e.y + n * a };
2996
3413
  },
2997
3414
  /** Line-line intersection */
2998
- lineIntersection(e, t, r, a) {
2999
- const o = (e.x - t.x) * (r.y - a.y) - (e.y - t.y) * (r.x - a.x);
3000
- if (Math.abs(o) < 1e-10)
3415
+ lineIntersection(e, t, r, o) {
3416
+ const a = (e.x - t.x) * (r.y - o.y) - (e.y - t.y) * (r.x - o.x);
3417
+ if (Math.abs(a) < 1e-10)
3001
3418
  return null;
3002
- const n = ((e.x - r.x) * (r.y - a.y) - (e.y - r.y) * (r.x - a.x)) / o;
3419
+ const n = ((e.x - r.x) * (r.y - o.y) - (e.y - r.y) * (r.x - o.x)) / a;
3003
3420
  return {
3004
3421
  x: e.x + n * (t.x - e.x),
3005
3422
  y: e.y + n * (t.y - e.y)
3006
3423
  };
3007
3424
  },
3008
3425
  /** Circle-line intersection */
3009
- circleLineIntersection(e, t, r, a) {
3010
- const o = a.x - r.x, n = a.y - r.y, i = r.x - e.x, l = r.y - e.y, p = o * o + n * n, s = 2 * (i * o + l * n), d = i * i + l * l - t * t, g = s * s - 4 * p * d;
3011
- if (g < 0)
3426
+ circleLineIntersection(e, t, r, o) {
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)
3012
3429
  return [];
3013
- const y = Math.sqrt(g), h = (-s - y) / (2 * p), w = (-s + y) / (2 * p), x = [];
3014
- return h >= 0 && h <= 1 && x.push({ x: r.x + h * o, y: r.y + h * n }), w >= 0 && w <= 1 && Math.abs(w - h) > 1e-10 && x.push({ x: r.x + w * o, y: r.y + w * 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;
3015
3432
  },
3016
3433
  /** Circle-circle intersection */
3017
- circleCircleIntersection(e, t, r, a) {
3018
- const o = this.distance(e, r);
3019
- if (o > t + a || o < Math.abs(t - a) || o === 0)
3434
+ circleCircleIntersection(e, t, r, o) {
3435
+ const a = this.distance(e, r);
3436
+ if (a > t + o || a < Math.abs(t - o) || a === 0)
3020
3437
  return [];
3021
- const n = (t * t - a * a + o * o) / (2 * o), i = Math.sqrt(t * t - n * n), l = e.x + n * (r.x - e.x) / o, p = e.y + n * (r.y - e.y) / o;
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;
3022
3439
  return [
3023
- { x: l + i * (r.y - e.y) / o, y: p - i * (r.x - e.x) / o },
3024
- { x: l - i * (r.y - e.y) / o, y: p + i * (r.x - e.x) / o }
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 }
3025
3442
  ];
3026
3443
  },
3027
3444
  /** Perpendicular line through point */
3028
3445
  perpendicularThrough(e, t, r) {
3029
3446
  this.closestPointOnLine(e, t, r);
3030
- const a = t.x - e.x, o = t.y - e.y;
3447
+ const o = t.x - e.x, a = t.y - e.y;
3031
3448
  return {
3032
3449
  p1: r,
3033
- p2: { x: r.x - o, y: r.y + a }
3450
+ p2: { x: r.x - a, y: r.y + o }
3034
3451
  };
3035
3452
  },
3036
3453
  /** Parallel line through point */
3037
3454
  parallelThrough(e, t, r) {
3038
- const a = t.x - e.x, o = t.y - e.y;
3455
+ const o = t.x - e.x, a = t.y - e.y;
3039
3456
  return {
3040
3457
  p1: r,
3041
- p2: { x: r.x + a, y: r.y + o }
3458
+ p2: { x: r.x + o, y: r.y + a }
3042
3459
  };
3043
3460
  },
3044
3461
  /** Angle bisector */
3045
3462
  angleBisector(e, t, r) {
3046
- const a = Math.atan2(e.y - t.y, e.x - t.x), o = Math.atan2(r.y - t.y, r.x - t.x);
3047
- let n = (a + o) / 2;
3048
- return Math.abs(o - a) > Math.PI && (n += Math.PI), {
3463
+ const o = Math.atan2(e.y - t.y, e.x - t.x), a = Math.atan2(r.y - t.y, r.x - t.x);
3464
+ let n = (o + a) / 2;
3465
+ return Math.abs(a - o) > Math.PI && (n += Math.PI), {
3049
3466
  x: t.x + Math.cos(n),
3050
3467
  y: t.y + Math.sin(n)
3051
3468
  };
3052
3469
  },
3053
3470
  /** Reflect point over line */
3054
3471
  reflect(e, t, r) {
3055
- const a = this.closestPointOnLine(t, r, e);
3472
+ const o = this.closestPointOnLine(t, r, e);
3056
3473
  return {
3057
- x: 2 * a.x - e.x,
3058
- y: 2 * a.y - e.y
3474
+ x: 2 * o.x - e.x,
3475
+ y: 2 * o.y - e.y
3059
3476
  };
3060
3477
  },
3061
3478
  /** Rotate point around center */
3062
3479
  rotate(e, t, r) {
3063
- const a = Math.cos(r), o = Math.sin(r), n = e.x - t.x, i = e.y - t.y;
3480
+ const o = Math.cos(r), a = Math.sin(r), n = e.x - t.x, i = e.y - t.y;
3064
3481
  return {
3065
- x: t.x + n * a - i * o,
3066
- y: t.y + n * o + i * a
3482
+ x: t.x + n * o - i * a,
3483
+ y: t.y + n * a + i * o
3067
3484
  };
3068
3485
  },
3069
3486
  /** Translate point */
@@ -3081,9 +3498,9 @@ const GeoMath = {
3081
3498
  polygonArea(e) {
3082
3499
  let t = 0;
3083
3500
  const r = e.length;
3084
- for (let a = 0; a < r; a++) {
3085
- const o = (a + 1) % r;
3086
- t += e[a].x * e[o].y, t -= e[o].x * e[a].y;
3501
+ for (let o = 0; o < r; o++) {
3502
+ const a = (o + 1) % r;
3503
+ t += e[o].x * e[a].y, t -= e[a].x * e[o].y;
3087
3504
  }
3088
3505
  return Math.abs(t) / 2;
3089
3506
  },
@@ -3091,23 +3508,23 @@ const GeoMath = {
3091
3508
  polygonPerimeter(e) {
3092
3509
  let t = 0;
3093
3510
  const r = e.length;
3094
- for (let a = 0; a < r; a++) {
3095
- const o = (a + 1) % r;
3096
- t += this.distance(e[a], e[o]);
3511
+ for (let o = 0; o < r; o++) {
3512
+ const a = (o + 1) % r;
3513
+ t += this.distance(e[o], e[a]);
3097
3514
  }
3098
3515
  return t;
3099
3516
  },
3100
3517
  /** Triangle circumcenter */
3101
3518
  circumcenter(e, t, r) {
3102
- const a = 2 * (e.x * (t.y - r.y) + t.x * (r.y - e.y) + r.x * (e.y - t.y)), o = ((e.x ** 2 + e.y ** 2) * (t.y - r.y) + (t.x ** 2 + t.y ** 2) * (r.y - e.y) + (r.x ** 2 + r.y ** 2) * (e.y - t.y)) / a, n = ((e.x ** 2 + e.y ** 2) * (r.x - t.x) + (t.x ** 2 + t.y ** 2) * (e.x - r.x) + (r.x ** 2 + r.y ** 2) * (t.x - e.x)) / a;
3103
- return { x: o, y: n };
3519
+ const o = 2 * (e.x * (t.y - r.y) + t.x * (r.y - e.y) + r.x * (e.y - t.y)), a = ((e.x ** 2 + e.y ** 2) * (t.y - r.y) + (t.x ** 2 + t.y ** 2) * (r.y - e.y) + (r.x ** 2 + r.y ** 2) * (e.y - t.y)) / o, n = ((e.x ** 2 + e.y ** 2) * (r.x - t.x) + (t.x ** 2 + t.y ** 2) * (e.x - r.x) + (r.x ** 2 + r.y ** 2) * (t.x - e.x)) / o;
3520
+ return { x: a, y: n };
3104
3521
  },
3105
3522
  /** Triangle incenter */
3106
3523
  incenter(e, t, r) {
3107
- const a = this.distance(e, t), o = this.distance(t, r), n = this.distance(r, e), i = a + o + n;
3524
+ const o = this.distance(e, t), a = this.distance(t, r), n = this.distance(r, e), i = o + a + n;
3108
3525
  return {
3109
- x: (o * e.x + n * t.x + a * r.x) / i,
3110
- y: (o * e.y + n * t.y + a * r.y) / i
3526
+ x: (a * e.x + n * t.x + o * r.x) / i,
3527
+ y: (a * e.y + n * t.y + o * r.y) / i
3111
3528
  };
3112
3529
  },
3113
3530
  /** Triangle centroid */
@@ -3118,15 +3535,15 @@ const GeoMath = {
3118
3535
  };
3119
3536
  }
3120
3537
  };
3121
- class GeometryService {
3538
+ class Ye {
3122
3539
  constructor() {
3123
- M(this, "elements", /* @__PURE__ */ new Map());
3124
- M(this, "nextLabel", 1);
3540
+ z(this, "elements", /* @__PURE__ */ new Map());
3541
+ z(this, "nextLabel", 1);
3125
3542
  }
3126
3543
  /** Add element */
3127
3544
  addElement(t) {
3128
- const r = this.generateId(), a = { ...t, id: r };
3129
- return this.elements.set(r, a), a;
3545
+ const r = this.generateId(), o = { ...t, id: r };
3546
+ return this.elements.set(r, o), o;
3130
3547
  }
3131
3548
  /** Get element */
3132
3549
  getElement(t) {
@@ -3139,15 +3556,15 @@ class GeometryService {
3139
3556
  }
3140
3557
  /** Update element */
3141
3558
  updateElement(t, r) {
3142
- const a = this.elements.get(t);
3143
- a && this.elements.set(t, { ...a, ...r, id: t, type: a.type });
3559
+ const o = this.elements.get(t);
3560
+ o && this.elements.set(t, { ...o, ...r, id: t, type: o.type });
3144
3561
  }
3145
3562
  /** Delete element */
3146
3563
  deleteElement(t) {
3147
3564
  var r;
3148
3565
  this.elements.delete(t);
3149
- for (const [a, o] of this.elements)
3150
- (r = o.dependencies) != null && r.includes(t) && this.deleteElement(a);
3566
+ for (const [o, a] of this.elements)
3567
+ (r = a.dependencies) != null && r.includes(t) && this.deleteElement(o);
3151
3568
  }
3152
3569
  /** Get all elements */
3153
3570
  getAllElements() {
@@ -3162,12 +3579,12 @@ class GeometryService {
3162
3579
  this.elements.clear(), this.nextLabel = 1;
3163
3580
  }
3164
3581
  /** Create point */
3165
- createPoint(t, r, a) {
3582
+ createPoint(t, r, o) {
3166
3583
  return this.addElement({
3167
3584
  type: "point",
3168
3585
  x: t,
3169
3586
  y: r,
3170
- label: a ?? this.getNextLabel(),
3587
+ label: o ?? this.getNextLabel(),
3171
3588
  color: { r: 0, g: 0, b: 0 },
3172
3589
  visible: !0,
3173
3590
  selected: !1,
@@ -3252,65 +3669,65 @@ class GeometryService {
3252
3669
  }
3253
3670
  /** Create midpoint */
3254
3671
  createMidpoint(t, r) {
3255
- const a = this.getPoint(t), o = this.getPoint(r);
3256
- if (!a || !o)
3672
+ const o = this.getPoint(t), a = this.getPoint(r);
3673
+ if (!o || !a)
3257
3674
  return null;
3258
- const n = GeoMath.midpoint(a, o), i = this.createPoint(n.x, n.y);
3675
+ const n = I.midpoint(o, a), i = this.createPoint(n.x, n.y);
3259
3676
  return i.dependencies = [t, r], i.color = { r: 0, g: 150, b: 0 }, i;
3260
3677
  }
3261
3678
  /** Create perpendicular */
3262
- createPerpendicular(t, r, a) {
3263
- const o = this.getPoint(t), n = this.getPoint(r), i = this.getPoint(a);
3264
- if (!o || !n || !i)
3679
+ createPerpendicular(t, r, o) {
3680
+ const a = this.getPoint(t), n = this.getPoint(r), i = this.getPoint(o);
3681
+ if (!a || !n || !i)
3265
3682
  return null;
3266
- const l = GeoMath.perpendicularThrough(o, n, i), p = this.createPoint(l.p2.x, l.p2.y), s = this.createLine(a, p.id);
3267
- return s.dependencies = [t, r, a], s;
3683
+ const l = I.perpendicularThrough(a, n, i), g = this.createPoint(l.p2.x, l.p2.y), s = this.createLine(o, g.id);
3684
+ return s.dependencies = [t, r, o], s;
3268
3685
  }
3269
3686
  /** Create parallel */
3270
- createParallel(t, r, a) {
3271
- const o = this.getPoint(t), n = this.getPoint(r), i = this.getPoint(a);
3272
- if (!o || !n || !i)
3687
+ createParallel(t, r, o) {
3688
+ const a = this.getPoint(t), n = this.getPoint(r), i = this.getPoint(o);
3689
+ if (!a || !n || !i)
3273
3690
  return null;
3274
- const l = GeoMath.parallelThrough(o, n, i), p = this.createPoint(l.p2.x, l.p2.y), s = this.createLine(a, p.id);
3275
- return s.dependencies = [t, r, a], s;
3691
+ const l = I.parallelThrough(a, n, i), g = this.createPoint(l.p2.x, l.p2.y), s = this.createLine(o, g.id);
3692
+ return s.dependencies = [t, r, o], s;
3276
3693
  }
3277
3694
  /** Create intersection point */
3278
3695
  createIntersection(t, r) {
3279
- const a = this.elements.get(t), o = this.elements.get(r);
3280
- if (!a || !o)
3696
+ const o = this.elements.get(t), a = this.elements.get(r);
3697
+ if (!o || !a)
3281
3698
  return [];
3282
3699
  const n = [], i = (s) => {
3283
3700
  if (s.type === "line" || s.type === "segment" || s.type === "ray") {
3284
- const d = s, g = this.getPoint(d.point1Id ?? d.originId), y = this.getPoint(d.point2Id ?? d.throughId);
3285
- if (g && y)
3286
- return [g, 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];
3287
3704
  }
3288
3705
  return null;
3289
- }, l = i(a), p = i(o);
3290
- if (l && p) {
3291
- const s = GeoMath.lineIntersection(l[0], l[1], p[0], p[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]);
3292
3709
  if (s) {
3293
- const d = this.createPoint(s.x, s.y);
3294
- d.dependencies = [t, r], d.color = { r: 255, g: 0, b: 0 }, n.push(d);
3710
+ const p = this.createPoint(s.x, s.y);
3711
+ p.dependencies = [t, r], p.color = { r: 255, g: 0, b: 0 }, n.push(p);
3295
3712
  }
3296
3713
  }
3297
- if (a.type === "circle" && p) {
3298
- const s = a, d = this.getPoint(s.centerId);
3299
- if (d) {
3300
- const g = GeoMath.circleLineIntersection(d, s.radius, p[0], p[1]);
3301
- for (const y of g) {
3302
- const h = this.createPoint(y.x, y.y);
3303
- h.dependencies = [t, r], h.color = { r: 255, g: 0, b: 0 }, n.push(h);
3714
+ if (o.type === "circle" && g) {
3715
+ const s = o, p = this.getPoint(s.centerId);
3716
+ if (p) {
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);
3720
+ f.dependencies = [t, r], f.color = { r: 255, g: 0, b: 0 }, n.push(f);
3304
3721
  }
3305
3722
  }
3306
3723
  }
3307
- if (a.type === "circle" && o.type === "circle") {
3308
- const s = a, d = o, g = this.getPoint(s.centerId), y = this.getPoint(d.centerId);
3309
- if (g && y) {
3310
- const h = GeoMath.circleCircleIntersection(g, s.radius, y, d.radius);
3311
- for (const w of h) {
3312
- const x = this.createPoint(w.x, w.y);
3313
- x.dependencies = [t, r], x.color = { r: 255, g: 0, b: 0 }, n.push(x);
3724
+ if (o.type === "circle" && a.type === "circle") {
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);
3314
3731
  }
3315
3732
  }
3316
3733
  }
@@ -3320,23 +3737,23 @@ class GeometryService {
3320
3737
  calculateMeasurement(t, r) {
3321
3738
  switch (t) {
3322
3739
  case "distance": {
3323
- const a = this.getPoint(r[0]), o = this.getPoint(r[1]);
3324
- if (a && o)
3325
- return GeoMath.distance(a, o);
3740
+ const o = this.getPoint(r[0]), a = this.getPoint(r[1]);
3741
+ if (o && a)
3742
+ return I.distance(o, a);
3326
3743
  break;
3327
3744
  }
3328
3745
  case "angle": {
3329
- const a = this.getPoint(r[0]), o = this.getPoint(r[1]), n = this.getPoint(r[2]);
3330
- if (a && o && n)
3331
- return GeoMath.angleDegrees(a, o, n);
3746
+ const o = this.getPoint(r[0]), a = this.getPoint(r[1]), n = this.getPoint(r[2]);
3747
+ if (o && a && n)
3748
+ return I.angleDegrees(o, a, n);
3332
3749
  break;
3333
3750
  }
3334
3751
  case "area":
3335
3752
  case "perimeter": {
3336
- const a = this.elements.get(r[0]);
3337
- if ((a == null ? void 0 : a.type) === "polygon") {
3338
- const o = a.pointIds.map((n) => this.getPoint(n)).filter(Boolean);
3339
- return t === "area" ? GeoMath.polygonArea(o) : GeoMath.polygonPerimeter(o);
3753
+ const o = this.elements.get(r[0]);
3754
+ if ((o == null ? void 0 : o.type) === "polygon") {
3755
+ const a = o.pointIds.map((n) => this.getPoint(n)).filter(Boolean);
3756
+ return t === "area" ? I.polygonArea(a) : I.polygonPerimeter(a);
3340
3757
  }
3341
3758
  break;
3342
3759
  }
@@ -3344,32 +3761,32 @@ class GeometryService {
3344
3761
  return 0;
3345
3762
  }
3346
3763
  /** Export to SVG */
3347
- exportSVG(t, r, a) {
3348
- const o = [
3764
+ exportSVG(t, r, o) {
3765
+ const a = [
3349
3766
  `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}">`
3350
3767
  ];
3351
- o.push(
3352
- `<rect width="100%" height="100%" fill="rgb(${a.backgroundColor.r},${a.backgroundColor.g},${a.backgroundColor.b})"/>`
3768
+ a.push(
3769
+ `<rect width="100%" height="100%" fill="rgb(${o.backgroundColor.r},${o.backgroundColor.g},${o.backgroundColor.b})"/>`
3353
3770
  );
3354
3771
  const n = (i, l) => ({
3355
- x: t / 2 + (i - a.centerX) * a.scale,
3356
- y: r / 2 - (l - a.centerY) * a.scale
3772
+ x: t / 2 + (i - o.centerX) * o.scale,
3773
+ y: r / 2 - (l - o.centerY) * o.scale
3357
3774
  });
3358
- if (a.showGrid) {
3359
- o.push('<g stroke="var(--nice-border, #ddd)" stroke-width="0.5">');
3360
- for (let i = Math.floor(-t / 2 / a.scale + a.centerX); i <= t / 2 / a.scale + a.centerX; i += a.gridSpacing) {
3775
+ if (o.showGrid) {
3776
+ a.push('<g stroke="var(--nice-border, #ddd)" stroke-width="0.5">');
3777
+ for (let i = Math.floor(-t / 2 / o.scale + o.centerX); i <= t / 2 / o.scale + o.centerX; i += o.gridSpacing) {
3361
3778
  const l = n(i, 0);
3362
- o.push(`<line x1="${l.x}" y1="0" x2="${l.x}" y2="${r}"/>`);
3779
+ a.push(`<line x1="${l.x}" y1="0" x2="${l.x}" y2="${r}"/>`);
3363
3780
  }
3364
- for (let i = Math.floor(-r / 2 / a.scale + a.centerY); i <= r / 2 / a.scale + a.centerY; i += a.gridSpacing) {
3781
+ for (let i = Math.floor(-r / 2 / o.scale + o.centerY); i <= r / 2 / o.scale + o.centerY; i += o.gridSpacing) {
3365
3782
  const l = n(0, i);
3366
- o.push(`<line x1="0" y1="${l.y}" x2="${t}" y2="${l.y}"/>`);
3783
+ a.push(`<line x1="0" y1="${l.y}" x2="${t}" y2="${l.y}"/>`);
3367
3784
  }
3368
- o.push("</g>");
3785
+ a.push("</g>");
3369
3786
  }
3370
- if (a.showAxes) {
3787
+ if (o.showAxes) {
3371
3788
  const i = n(0, 0);
3372
- o.push('<g stroke="var(--nice-text, #333)" stroke-width="1">'), o.push(`<line x1="0" y1="${i.y}" x2="${t}" y2="${i.y}"/>`), o.push(`<line x1="${i.x}" y1="0" x2="${i.x}" y2="${r}"/>`), o.push("</g>");
3789
+ a.push('<g stroke="var(--nice-text, #333)" stroke-width="1">'), a.push(`<line x1="0" y1="${i.y}" x2="${t}" y2="${i.y}"/>`), a.push(`<line x1="${i.x}" y1="0" x2="${i.x}" y2="${r}"/>`), a.push("</g>");
3373
3790
  }
3374
3791
  for (const i of this.getAllElements()) {
3375
3792
  if (!i.visible)
@@ -3377,43 +3794,43 @@ class GeometryService {
3377
3794
  const l = `rgb(${i.color.r},${i.color.g},${i.color.b})`;
3378
3795
  switch (i.type) {
3379
3796
  case "point": {
3380
- const p = n(i.x, i.y);
3381
- o.push(`<circle cx="${p.x}" cy="${p.y}" r="${i.size}" fill="${l}"/>`), i.label && o.push(`<text x="${p.x + 8}" y="${p.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>`);
3382
3799
  break;
3383
3800
  }
3384
3801
  case "segment": {
3385
- const p = this.getPoint(i.point1Id), s = this.getPoint(i.point2Id);
3386
- if (p && s) {
3387
- const d = n(p.x, p.y), g = n(s.x, s.y);
3388
- o.push(
3389
- `<line x1="${d.x}" y1="${d.y}" x2="${g.x}" y2="${g.y}" stroke="${l}" stroke-width="${i.width}"/>`
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);
3805
+ a.push(
3806
+ `<line x1="${p.x}" y1="${p.y}" x2="${u.x}" y2="${u.y}" stroke="${l}" stroke-width="${i.width}"/>`
3390
3807
  );
3391
3808
  }
3392
3809
  break;
3393
3810
  }
3394
3811
  case "circle": {
3395
- const p = this.getPoint(i.centerId);
3396
- if (p) {
3397
- const s = n(p.x, p.y), d = i.radius * a.scale, g = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
3398
- o.push(
3399
- `<circle cx="${s.x}" cy="${s.y}" r="${d}" fill="${g}" stroke="${l}" stroke-width="${i.width}"/>`
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";
3815
+ a.push(
3816
+ `<circle cx="${s.x}" cy="${s.y}" r="${p}" fill="${u}" stroke="${l}" stroke-width="${i.width}"/>`
3400
3817
  );
3401
3818
  }
3402
3819
  break;
3403
3820
  }
3404
3821
  case "polygon": {
3405
- const p = i.pointIds.map((s) => this.getPoint(s)).filter(Boolean);
3406
- if (p.length > 0) {
3407
- const d = p.map((y) => n(y.x, y.y)).map((y, h) => `${h === 0 ? "M" : "L"}${y.x},${y.y}`).join(" ") + " Z", g = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
3408
- o.push(
3409
- `<path d="${d}" fill="${g}" stroke="${l}" stroke-width="${i.width}"/>`
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";
3825
+ a.push(
3826
+ `<path d="${p}" fill="${u}" stroke="${l}" stroke-width="${i.width}"/>`
3410
3827
  );
3411
3828
  }
3412
3829
  break;
3413
3830
  }
3414
3831
  }
3415
3832
  }
3416
- return o.push("</svg>"), o.join(`
3833
+ return a.push("</svg>"), a.join(`
3417
3834
  `);
3418
3835
  }
3419
3836
  generateId() {
@@ -3424,17 +3841,17 @@ class GeometryService {
3424
3841
  return this.nextLabel++, r < 26 ? t[r] : t[r % 26] + Math.floor(r / 26);
3425
3842
  }
3426
3843
  }
3427
- function createGeometryService() {
3428
- return new GeometryService();
3844
+ function st() {
3845
+ return new Ye();
3429
3846
  }
3430
- const GeometryContext = createContext(null);
3431
- function useGeometry() {
3432
- const e = useContext(GeometryContext);
3847
+ const ge = /* @__PURE__ */ O(null);
3848
+ function H() {
3849
+ const e = F(ge);
3433
3850
  if (!e)
3434
3851
  throw new Error("useGeometry must be used within GeometryProvider");
3435
3852
  return e;
3436
3853
  }
3437
- const styles = {
3854
+ const q = {
3438
3855
  container: {
3439
3856
  display: "flex",
3440
3857
  height: "100%",
@@ -3483,14 +3900,14 @@ const styles = {
3483
3900
  color: "var(--nice-text-secondary, #666)"
3484
3901
  }
3485
3902
  };
3486
- function NiceGeometry({
3903
+ function lt({
3487
3904
  service: e,
3488
3905
  width: t = 800,
3489
3906
  height: r = 600,
3490
- className: a,
3491
- style: o
3907
+ className: o,
3908
+ style: a
3492
3909
  }) {
3493
- const [n, i] = useState([]), [l, p] = useState("point"), [s, d] = useState([]), [g, y] = useState({
3910
+ const [n, i] = M([]), [l, g] = M("point"), [s, p] = M([]), [u, x] = M({
3494
3911
  centerX: 0,
3495
3912
  centerY: 0,
3496
3913
  scale: 40,
@@ -3500,321 +3917,325 @@ function NiceGeometry({
3500
3917
  snapToGrid: !0,
3501
3918
  snapToPoints: !0,
3502
3919
  backgroundColor: { r: 255, g: 255, b: 255 }
3503
- }), h = useCallback(() => {
3920
+ }), f = R(() => {
3504
3921
  i(e.getAllElements());
3505
- }, [e]), w = useCallback((f) => {
3506
- y((c) => ({ ...c, ...f }));
3922
+ }, [e]), w = R((b) => {
3923
+ x((c) => ({ ...c, ...b }));
3507
3924
  }, []);
3508
- useEffect(() => {
3509
- h();
3510
- }, [h]);
3511
- const x = {
3925
+ Y(() => {
3926
+ f();
3927
+ }, [f]);
3928
+ const y = {
3512
3929
  service: e,
3513
3930
  elements: n,
3514
3931
  tool: l,
3515
- setTool: p,
3516
- view: g,
3932
+ setTool: g,
3933
+ view: u,
3517
3934
  setView: w,
3518
3935
  selectedIds: s,
3519
- setSelectedIds: d,
3520
- refresh: h
3936
+ setSelectedIds: p,
3937
+ refresh: f
3521
3938
  };
3522
- return /* @__PURE__ */ jsx(GeometryContext.Provider, { value: x, children: /* @__PURE__ */ jsxs("div", { className: a, style: { ...styles.container, ...o }, children: [
3523
- /* @__PURE__ */ jsx(Toolbar, {}),
3524
- /* @__PURE__ */ jsxs("div", { style: styles.main, children: [
3525
- /* @__PURE__ */ jsx(Canvas, { width: t, height: r }),
3526
- /* @__PURE__ */ jsx(StatusBar, { width: t, height: r })
3939
+ return /* @__PURE__ */ d(ge.Provider, { value: y, children: /* @__PURE__ */ v("div", { className: o, style: { ...q.container, ...a }, children: [
3940
+ /* @__PURE__ */ d(Ve, {}),
3941
+ /* @__PURE__ */ v("div", { style: q.main, children: [
3942
+ /* @__PURE__ */ d(Ke, { width: t, height: r }),
3943
+ /* @__PURE__ */ d(We, { width: t, height: r })
3527
3944
  ] })
3528
3945
  ] }) });
3529
3946
  }
3530
- function Toolbar() {
3531
- const { tool: e, setTool: t } = useGeometry(), r = [
3532
- { id: "select", icon: "cursor", title: "Select" },
3533
- { id: "point", icon: "•", title: "Point" },
3534
- { id: "segment", icon: "—", title: "Segment" },
3535
- { id: "line", icon: "line", title: "Line" },
3536
- { id: "ray", icon: "arrow-right", title: "Ray" },
3537
- { id: "circle", icon: "circle", title: "Circle" },
3538
- { id: "polygon", icon: "triangle", title: "Polygon" },
3539
- { id: "perpendicular", icon: "⊥", title: "Perpendicular" },
3540
- { id: "parallel", icon: "∥", title: "Parallel" },
3541
- { id: "midpoint", icon: "⊙", title: "Midpoint" },
3542
- { id: "bisector", icon: "∠", title: "Angle Bisector" },
3543
- { id: "intersection", icon: "close", title: "Intersection" },
3544
- { id: "reflect", icon: "shuffle", title: "Reflect" },
3545
- { id: "rotate", icon: "refresh", title: "Rotate" },
3546
- { 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") }
3547
3972
  ];
3548
- return /* @__PURE__ */ jsx("div", { style: styles.toolbar, children: r.map((a) => /* @__PURE__ */ jsx(
3973
+ return /* @__PURE__ */ d("div", { style: q.toolbar, children: o.map((a) => /* @__PURE__ */ d(
3549
3974
  "button",
3550
3975
  {
3551
- onClick: () => t(a.id),
3976
+ onClick: () => r(a.id),
3552
3977
  title: a.title,
3553
3978
  style: {
3554
- ...styles.toolButton,
3555
- backgroundColor: e === a.id ? "var(--nice-primary-hover, #1976d2)" : "transparent",
3556
- color: e === a.id ? "var(--nice-color-white, #fff)" : "var(--nice-text, #333)"
3979
+ ...q.toolButton,
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)"
3557
3982
  },
3558
- children: /^[a-z][a-z0-9-]*$/.test(a.icon) ? /* @__PURE__ */ jsx(NiceIcon$1, { name: a.icon, size: 16 }) : a.icon
3983
+ children: /* @__PURE__ */ d(j, { name: a.icon, size: 16 })
3559
3984
  },
3560
3985
  a.id
3561
3986
  )) });
3562
3987
  }
3563
- function Canvas({ width: e, height: t }) {
3564
- const r = useRef(null), { service: a, elements: o, tool: n, view: i, selectedIds: l, setSelectedIds: p, refresh: s } = useGeometry(), [d, g] = useState([]), y = useCallback(
3565
- (f, c) => {
3566
- const u = (f - e / 2) / i.scale + i.centerX, b = -(c - 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;
3567
3992
  return i.snapToGrid ? {
3568
- x: Math.round(u / i.gridSpacing) * i.gridSpacing,
3569
- y: Math.round(b / i.gridSpacing) * i.gridSpacing
3570
- } : { x: u, y: b };
3993
+ x: Math.round(m / i.gridSpacing) * i.gridSpacing,
3994
+ y: Math.round(k / i.gridSpacing) * i.gridSpacing
3995
+ } : { x: m, y: k };
3571
3996
  },
3572
3997
  [e, t, i]
3573
- ), h = useCallback(
3574
- (f, c) => ({
3575
- x: e / 2 + (f - i.centerX) * i.scale,
3998
+ ), f = R(
3999
+ (b, c) => ({
4000
+ x: e / 2 + (b - i.centerX) * i.scale,
3576
4001
  y: t / 2 - (c - i.centerY) * i.scale
3577
4002
  }),
3578
4003
  [e, t, i]
3579
- ), w = useCallback(
3580
- (f) => {
3581
- var b;
3582
- const c = (b = r.current) == null ? void 0 : b.getBoundingClientRect();
4004
+ ), w = R(
4005
+ (b) => {
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();
3583
4015
  if (!c)
3584
4016
  return;
3585
- const u = y(f.clientX - c.left, f.clientY - c.top);
4017
+ const m = x(b.clientX - c.left, b.clientY - c.top);
3586
4018
  switch (n) {
3587
4019
  case "point": {
3588
- a.createPoint(u.x, u.y), s();
4020
+ o.createPoint(m.x, m.y), s();
3589
4021
  break;
3590
4022
  }
3591
4023
  case "segment":
3592
4024
  case "line":
3593
4025
  case "ray": {
3594
- const k = x(u);
3595
- if (k)
3596
- g((m) => {
3597
- const v = [...m, k.id];
3598
- return v.length === 2 ? (n === "segment" ? a.createSegment(v[0], v[1]) : n === "line" ? a.createLine(v[0], v[1]) : n === "ray" && a.createRay(v[0], v[1]), s(), []) : v;
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;
3599
4031
  });
3600
4032
  else {
3601
- const m = a.createPoint(u.x, u.y);
3602
- g((v) => {
3603
- const C = [...v, m.id];
3604
- return C.length === 2 ? (n === "segment" ? a.createSegment(C[0], C[1]) : n === "line" ? a.createLine(C[0], C[1]) : n === "ray" && a.createRay(C[0], C[1]), s(), []) : C;
4033
+ const h = o.createPoint(m.x, m.y);
4034
+ u((P) => {
4035
+ const S = [...P, h.id];
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;
3605
4037
  }), s();
3606
4038
  }
3607
4039
  break;
3608
4040
  }
3609
4041
  case "circle": {
3610
- const k = x(u);
3611
- if (k)
3612
- g((m) => {
3613
- if (m.length === 0)
3614
- return [k.id];
3615
- const v = a.getPoint(m[0]);
3616
- if (v) {
3617
- const C = GeoMath.distance(v, u);
3618
- a.createCircle(m[0], C), s();
4042
+ const C = w(m);
4043
+ if (C)
4044
+ u((h) => {
4045
+ if (h.length === 0)
4046
+ return [C.id];
4047
+ const P = o.getPoint(h[0]);
4048
+ if (P) {
4049
+ const S = I.distance(P, m);
4050
+ o.createCircle(h[0], S), s();
3619
4051
  }
3620
4052
  return [];
3621
4053
  });
3622
- else if (d.length === 1) {
3623
- const m = a.getPoint(d[0]);
3624
- if (m) {
3625
- const v = GeoMath.distance(m, u);
3626
- a.createCircle(d[0], v), s(), g([]);
4054
+ else if (p.length === 1) {
4055
+ const h = o.getPoint(p[0]);
4056
+ if (h) {
4057
+ const P = I.distance(h, m);
4058
+ o.createCircle(p[0], P), s(), u([]);
3627
4059
  }
3628
4060
  } else {
3629
- const m = a.createPoint(u.x, u.y);
3630
- g([m.id]), s();
4061
+ const h = o.createPoint(m.x, m.y);
4062
+ u([h.id]), s();
3631
4063
  }
3632
4064
  break;
3633
4065
  }
3634
4066
  case "midpoint": {
3635
- const k = x(u);
3636
- k && g((m) => {
3637
- const v = [...m, k.id];
3638
- return v.length === 2 ? (a.createMidpoint(v[0], v[1]), s(), []) : v;
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;
3639
4071
  });
3640
4072
  break;
3641
4073
  }
3642
4074
  case "select": {
3643
- const k = x(u);
3644
- p(k ? [k.id] : []);
4075
+ const C = w(m);
4076
+ g(C ? [C.id] : []);
3645
4077
  break;
3646
4078
  }
3647
4079
  }
3648
4080
  },
3649
- [n, a, s, y, d, p]
3650
- ), x = (f) => {
3651
- for (const u of o)
3652
- if (u.type === "point" && GeoMath.distance(u, f) < 0.5)
3653
- return u;
3654
- };
3655
- return useEffect(() => {
3656
- const f = r.current, c = f == null ? void 0 : f.getContext("2d");
3657
- if (!(!f || !c)) {
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)) {
3658
4086
  if (c.fillStyle = `rgb(${i.backgroundColor.r},${i.backgroundColor.g},${i.backgroundColor.b})`, c.fillRect(0, 0, e, t), i.showGrid) {
3659
- c.strokeStyle = resolveCssColor("var(--nice-border, #e0e0e0)", c.canvas), c.lineWidth = 0.5;
3660
- const u = i.gridSpacing * i.scale, b = (e / 2 - i.centerX * i.scale) % u, k = (t / 2 + i.centerY * i.scale) % u;
3661
- for (let m = b; m < e; m += u)
3662
- c.beginPath(), c.moveTo(m, 0), c.lineTo(m, t), c.stroke();
3663
- for (let m = k; m < t; m += u)
3664
- c.beginPath(), c.moveTo(0, m), c.lineTo(e, m), c.stroke();
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();
3665
4093
  }
3666
4094
  if (i.showAxes) {
3667
- const u = h(0, 0);
3668
- c.strokeStyle = resolveCssColor("var(--nice-text, #333)", c.canvas), c.lineWidth = 1, c.beginPath(), c.moveTo(0, u.y), c.lineTo(e, u.y), c.stroke(), c.beginPath(), c.moveTo(u.x, 0), c.lineTo(u.x, t), c.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();
3669
4097
  }
3670
- for (const u of o) {
3671
- if (!u.visible)
4098
+ for (const m of a) {
4099
+ if (!m.visible)
3672
4100
  continue;
3673
- const b = `rgb(${u.color.r},${u.color.g},${u.color.b})`, k = l.includes(u.id);
3674
- switch (u.type) {
4101
+ const k = `rgb(${m.color.r},${m.color.g},${m.color.b})`, C = l.includes(m.id);
4102
+ switch (m.type) {
3675
4103
  case "point": {
3676
- const m = h(u.x, u.y);
3677
- c.beginPath(), c.arc(m.x, m.y, k ? u.size + 2 : u.size, 0, 2 * Math.PI), c.fillStyle = k ? resolveCssColor("var(--nice-primary-hover, #1976d2)", c.canvas) : b, c.fill(), u.label && (c.fillStyle = resolveCssColor("var(--nice-text, #333)", c.canvas), c.font = "12px sans-serif", c.fillText(u.label, m.x + 8, m.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));
3678
4106
  break;
3679
4107
  }
3680
4108
  case "segment": {
3681
- const m = a.getPoint(u.point1Id), v = a.getPoint(u.point2Id);
3682
- if (m && v) {
3683
- const C = h(m.x, m.y), S = h(v.x, v.y);
3684
- c.strokeStyle = b, c.lineWidth = u.width, c.beginPath(), c.moveTo(C.x, C.y), c.lineTo(S.x, S.y), c.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();
3685
4113
  }
3686
4114
  break;
3687
4115
  }
3688
4116
  case "line": {
3689
- const m = a.getPoint(u.point1Id), v = a.getPoint(u.point2Id);
3690
- if (m && v) {
3691
- const C = v.x - m.x, S = v.y - m.y, P = -1e3, j = 1e3, $ = h(m.x + P * C, m.y + P * S), B = h(m.x + j * C, m.y + j * S);
3692
- c.strokeStyle = b, c.lineWidth = u.width, c.beginPath(), c.moveTo($.x, $.y), c.lineTo(B.x, B.y), c.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();
3693
4121
  }
3694
4122
  break;
3695
4123
  }
3696
4124
  case "circle": {
3697
- const m = a.getPoint(u.centerId);
3698
- if (m) {
3699
- const v = h(m.x, m.y), C = u.radius * i.scale;
3700
- c.beginPath(), c.arc(v.x, v.y, C, 0, 2 * Math.PI), u.fill && (c.fillStyle = `rgba(${u.fill.r},${u.fill.g},${u.fill.b},${u.fill.a ?? 0.2})`, c.fill()), c.strokeStyle = b, c.lineWidth = u.width, c.stroke();
4125
+ const h = o.getPoint(m.centerId);
4126
+ if (h) {
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();
3701
4129
  }
3702
4130
  break;
3703
4131
  }
3704
4132
  case "polygon": {
3705
- const m = u.pointIds.map((v) => a.getPoint(v)).filter(Boolean);
3706
- if (m.length > 0) {
4133
+ const h = m.pointIds.map((P) => o.getPoint(P)).filter(Boolean);
4134
+ if (h.length > 0) {
3707
4135
  c.beginPath();
3708
- const v = h(m[0].x, m[0].y);
3709
- c.moveTo(v.x, v.y);
3710
- for (let C = 1; C < m.length; C++) {
3711
- const S = h(m[C].x, m[C].y);
3712
- c.lineTo(S.x, S.y);
4136
+ const P = f(h[0].x, h[0].y);
4137
+ c.moveTo(P.x, P.y);
4138
+ for (let S = 1; S < h.length; S++) {
4139
+ const L = f(h[S].x, h[S].y);
4140
+ c.lineTo(L.x, L.y);
3713
4141
  }
3714
- c.closePath(), u.fill && (c.fillStyle = `rgba(${u.fill.r},${u.fill.g},${u.fill.b},${u.fill.a ?? 0.2})`, c.fill()), c.strokeStyle = b, c.lineWidth = u.width, c.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();
3715
4143
  }
3716
4144
  break;
3717
4145
  }
3718
4146
  }
3719
4147
  }
3720
- if (d.length > 0) {
3721
- c.fillStyle = "rgba(25, 118, 210, 0.3)";
3722
- for (const u of d) {
3723
- const b = a.getPoint(u);
3724
- if (b) {
3725
- const k = h(b.x, b.y);
3726
- c.beginPath(), c.arc(k.x, k.y, 12, 0, 2 * Math.PI), c.fill();
4148
+ if (p.length > 0) {
4149
+ c.fillStyle = D(
4150
+ "var(--nice-primary-tint-30, rgba(25, 118, 210, 0.3))",
4151
+ c.canvas
4152
+ );
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();
3727
4158
  }
3728
4159
  }
3729
4160
  }
3730
4161
  }
3731
- }, [o, i, e, t, l, d, a, h]), /* @__PURE__ */ jsx(
4162
+ }, [a, i, e, t, l, p, o, f]), /* @__PURE__ */ d(
3732
4163
  "canvas",
3733
4164
  {
3734
4165
  ref: r,
3735
4166
  width: e,
3736
4167
  height: t,
3737
- style: styles.canvas,
3738
- onClick: w
4168
+ style: q.canvas,
4169
+ onClick: y
3739
4170
  }
3740
4171
  );
3741
4172
  }
3742
- function StatusBar({
4173
+ function We({
3743
4174
  width: e,
3744
4175
  height: t
3745
4176
  }) {
3746
- const { tool: r, elements: a, view: o, service: n } = useGeometry(), [i, l] = useState(null), p = {
3747
- select: "Select",
3748
- point: "Point",
3749
- line: "Line",
3750
- ray: "Ray",
3751
- segment: "Segment",
3752
- circle: "Circle",
3753
- arc: "Arc",
3754
- polygon: "Polygon",
3755
- angle: "Angle",
3756
- perpendicular: "Perpendicular",
3757
- parallel: "Parallel",
3758
- bisector: "Angle Bisector",
3759
- midpoint: "Midpoint",
3760
- tangent: "Tangent",
3761
- intersection: "Intersection",
3762
- reflect: "Reflect",
3763
- rotate: "Rotate",
3764
- translate: "Translate",
3765
- dilate: "Dilate",
3766
- measure: "Measure",
3767
- text: "Text"
3768
- }, s = a.filter((d) => d.type === "point").length;
3769
- return /* @__PURE__ */ jsxs("div", { style: styles.statusBar, children: [
3770
- /* @__PURE__ */ jsxs("span", { children: [
3771
- "Tool: ",
3772
- p[r]
3773
- ] }),
3774
- /* @__PURE__ */ jsx("span", { style: { margin: "0 16px" }, children: "|" }),
3775
- /* @__PURE__ */ jsxs("span", { children: [
3776
- "Objects: ",
3777
- a.length
3778
- ] }),
3779
- /* @__PURE__ */ jsx("span", { style: { margin: "0 16px" }, children: "|" }),
3780
- /* @__PURE__ */ jsxs("span", { children: [
3781
- "Points: ",
3782
- s
3783
- ] }),
3784
- /* @__PURE__ */ jsx("span", { style: { margin: "0 16px" }, children: "|" }),
3785
- /* @__PURE__ */ jsxs("span", { children: [
3786
- "Scale: ",
3787
- o.scale.toFixed(1),
3788
- "x"
3789
- ] })
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;
4200
+ return /* @__PURE__ */ v("div", { style: q.statusBar, children: [
4201
+ /* @__PURE__ */ d("span", { children: r("geometry.tool", "Tool: {tool}").replace("{tool}", String(s[o])) }),
4202
+ /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
4203
+ /* @__PURE__ */ d("span", { children: r("geometry.objects", "Objects: {elements}").replace(
4204
+ "{elements}",
4205
+ String(a.length)
4206
+ ) }),
4207
+ /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
4208
+ /* @__PURE__ */ d("span", { children: r("geometry.points", "Points: {pointCount}").replace("{pointCount}", String(p)) }),
4209
+ /* @__PURE__ */ d("span", { style: { margin: "0 16px" }, children: "|" }),
4210
+ /* @__PURE__ */ d("span", { children: r("geometry.scaleX", "Scale: {scale}x").replace("{scale}", String(n.scale.toFixed(1))) })
3790
4211
  ] });
3791
4212
  }
3792
4213
  export {
3793
- CalculatorService,
3794
- CalculusOps,
3795
- EQUATION_TEMPLATES,
3796
- ExpressionParser,
3797
- FUNCTION_PRESETS,
3798
- GeoMath,
3799
- GeometryService,
3800
- GraphService,
3801
- MATH_SYMBOLS,
3802
- MathEditorService,
3803
- MatrixOps,
3804
- NiceCalculator,
3805
- NiceGeometry,
3806
- NiceGraphPlotter,
3807
- NiceI18nProvider,
3808
- NiceMathEditor,
3809
- createCalculatorService,
3810
- createGeometryService,
3811
- createGraphService,
3812
- createMathEditorService,
3813
- getSymbolsByCategory,
3814
- recognizeHandwriting,
3815
- useCalculator,
3816
- useGeometry,
3817
- useGraph,
3818
- useMathEditor,
3819
- useNiceTranslation
4214
+ qe as CalculatorService,
4215
+ te as CalculusOps,
4216
+ Pe as EQUATION_TEMPLATES,
4217
+ le as ExpressionParser,
4218
+ ee as FUNCTION_PRESETS,
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,
4235
+ Ce as recognizeHandwriting,
4236
+ X as useCalculator,
4237
+ H as useGeometry,
4238
+ V as useGraph,
4239
+ W as useMathEditor,
4240
+ E as useNiceTranslation
3820
4241
  };