From 37ef269ed700ecf03bf1d53e1b8572a459b605e2 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 03:30:23 +0000 Subject: [PATCH] =?UTF-8?q?Web:=20Kn=C3=B6pfe=20Lernen=20und=20Code=20live?= =?UTF-8?q?=20aus=20der=20Werkzeugleiste=20entfernt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Beide Bereiche öffnen sich über ihre Seitenleiste und schließen sich mit dem Seitenleisten-Symbol. Lektion 2 erklärt das jetzt (de/en/pt), der Zeiger #zeige-lernen zeigt auf das Symbol. Außerdem behoben: Bei offenem Lernbereich war die Leiste „Code live“ rechts ausgeblendet. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01Ej8WiXwHqbpcLApU1GzAn2 --- web/lessons/de/02-der-editor.md | 2 +- web/lessons/en/02-der-editor.md | 2 +- web/lessons/pt/02-der-editor.md | 2 +- web/src/i18n/ar.strings | 1 - web/src/i18n/da.strings | 1 - web/src/i18n/de.strings | 2 - web/src/i18n/el.strings | 1 - web/src/i18n/en.strings | 2 - web/src/i18n/es.strings | 1 - web/src/i18n/fr.strings | 1 - web/src/i18n/he.strings | 1 - web/src/i18n/it.strings | 1 - web/src/i18n/ja.strings | 1 - web/src/i18n/ko.strings | 1 - web/src/i18n/nb.strings | 1 - web/src/i18n/nl.strings | 1 - web/src/i18n/pl.strings | 1 - web/src/i18n/pt-PT.strings | 2 - web/src/i18n/ru.strings | 1 - web/src/i18n/sv.strings | 1 - web/src/i18n/tr.strings | 1 - web/src/i18n/uk.strings | 1 - web/src/i18n/zh-Hans.strings | 1 - web/src/i18n/zh-Hant.strings | 1 - web/src/ui/app.ts | 14 ------ web/src/ui/styles.css | 10 +--- web/src/ui/termTips.ts | 2 +- .../assets/{ar-CvVmBZfx.js => ar-COQZmxPT.js} | 1 - .../assets/{da-DsSrdnBT.js => da-Chd6sURw.js} | 1 - .../assets/{de-CqCSi5uB.js => de-BqSJbBFG.js} | 2 - .../assets/{el-DrfOXLmq.js => el-C7O2XkiD.js} | 1 - .../assets/{en-DAKqKtlO.js => en-BU37XAsV.js} | 2 - .../assets/{es-CC-_nS8U.js => es-DcQytQNI.js} | 1 - .../assets/{fr-xxMJQhld.js => fr-0goWcne4.js} | 1 - .../assets/{he-D_sMncu9.js => he-iK8j7NgI.js} | 1 - .../{index-DxIR6zjj.js => index-07bmFCF5.js} | 50 +++++++++---------- ...{index-H9tqnCHk.css => index-CWMWwjGt.css} | 2 +- .../assets/{it-CQO8hRgc.js => it-DbDiZBco.js} | 1 - .../assets/{ja-La_WZu6k.js => ja-C3rHFfYH.js} | 1 - .../assets/{ko-DObNRxlY.js => ko-Co7zOA8X.js} | 1 - .../assets/{nb-X4VbD4CE.js => nb-D7cbcu7D.js} | 1 - .../assets/{nl-CdeYgYYf.js => nl-Dq2LX98h.js} | 1 - .../assets/{pl-Jtu3L1c4.js => pl-AtW6u2Bg.js} | 1 - .../{pt-PT-BKaCFzc4.js => pt-PT-DsE2Zies.js} | 2 - .../assets/{ru-CvjW0r5W.js => ru-S-OGDMjr.js} | 1 - .../assets/{sv-29L8cFQi.js => sv-BgYrXVSc.js} | 1 - .../assets/{tr-MtsbQ98M.js => tr-CrrRFe4L.js} | 1 - .../assets/{uk-BeltaX1a.js => uk-CWUyWuF5.js} | 1 - ...h-Hans-B4JA_Azf.js => zh-Hans-DxaX4UOg.js} | 1 - ...h-Hant-Cv-_Uw4T.js => zh-Hant-DTRor7O5.js} | 1 - website/app/index.html | 4 +- 51 files changed, 32 insertions(+), 104 deletions(-) rename website/app/assets/{ar-CvVmBZfx.js => ar-COQZmxPT.js} (97%) rename website/app/assets/{da-DsSrdnBT.js => da-Chd6sURw.js} (97%) rename website/app/assets/{de-CqCSi5uB.js => de-BqSJbBFG.js} (97%) rename website/app/assets/{el-DrfOXLmq.js => el-C7O2XkiD.js} (97%) rename website/app/assets/{en-DAKqKtlO.js => en-BU37XAsV.js} (97%) rename website/app/assets/{es-CC-_nS8U.js => es-DcQytQNI.js} (97%) rename website/app/assets/{fr-xxMJQhld.js => fr-0goWcne4.js} (97%) rename website/app/assets/{he-D_sMncu9.js => he-iK8j7NgI.js} (97%) rename website/app/assets/{index-DxIR6zjj.js => index-07bmFCF5.js} (97%) rename website/app/assets/{index-H9tqnCHk.css => index-CWMWwjGt.css} (55%) rename website/app/assets/{it-CQO8hRgc.js => it-DbDiZBco.js} (97%) rename website/app/assets/{ja-La_WZu6k.js => ja-C3rHFfYH.js} (98%) rename website/app/assets/{ko-DObNRxlY.js => ko-Co7zOA8X.js} (97%) rename website/app/assets/{nb-X4VbD4CE.js => nb-D7cbcu7D.js} (97%) rename website/app/assets/{nl-CdeYgYYf.js => nl-Dq2LX98h.js} (98%) rename website/app/assets/{pl-Jtu3L1c4.js => pl-AtW6u2Bg.js} (98%) rename website/app/assets/{pt-PT-BKaCFzc4.js => pt-PT-DsE2Zies.js} (97%) rename website/app/assets/{ru-CvjW0r5W.js => ru-S-OGDMjr.js} (97%) rename website/app/assets/{sv-29L8cFQi.js => sv-BgYrXVSc.js} (98%) rename website/app/assets/{tr-MtsbQ98M.js => tr-CrrRFe4L.js} (97%) rename website/app/assets/{uk-BeltaX1a.js => uk-CWUyWuF5.js} (97%) rename website/app/assets/{zh-Hans-B4JA_Azf.js => zh-Hans-DxaX4UOg.js} (98%) rename website/app/assets/{zh-Hant-Cv-_Uw4T.js => zh-Hant-DTRor7O5.js} (98%) diff --git a/web/lessons/de/02-der-editor.md b/web/lessons/de/02-der-editor.md index 1cc5e547..3527447c 100644 --- a/web/lessons/de/02-der-editor.md +++ b/web/lessons/de/02-der-editor.md @@ -13,7 +13,7 @@ Der Editor besteht aus vier Bereichen. Fahre mit der Maus über ein blaues Wort - **In der Mitte das [Struktogramm](#zeige-struktogramm):** Ein neues Diagramm enthält nur einen leeren Platzhalter, erkennbar an **ø**. - **Unten der [Objektinspektor](#zeige-objektinspektor):** Hier bearbeitest du den Text des ausgewählten Elements. -> Diesen Lernbereich kannst du jederzeit über [Lernen](#zeige-lernen) in der Leiste ein- und ausblenden. Er bleibt neben dem Editor offen, damit du gleich ausprobieren kannst, was du liest. +> Diesen Lernbereich kannst du jederzeit mit dem [Seitenleisten-Symbol](#zeige-lernen) oben in diesem Bereich einklappen. Dann bleibt links nur die schmale Leiste „🎓 Lernen“, ein Klick darauf öffnet ihn wieder. Er bleibt neben dem Editor offen, damit du gleich ausprobieren kannst, was du liest. ## Ein Element einfügen diff --git a/web/lessons/en/02-der-editor.md b/web/lessons/en/02-der-editor.md index 3f126e1a..95f72cbc 100644 --- a/web/lessons/en/02-der-editor.md +++ b/web/lessons/en/02-der-editor.md @@ -13,7 +13,7 @@ The editor has four areas. Move the mouse over a blue word or tap it, and that a - **In the middle, the [structure chart](#zeige-struktogramm):** A new diagram contains only an empty placeholder, marked with **ø**. - **At the bottom, the [Object Inspector](#zeige-objektinspektor):** Here you edit the text of the selected element. -> You can show and hide this learning area at any time with [Learn](#zeige-lernen) in the toolbar. It stays open next to the editor so you can try out right away what you read. +> You can collapse this learning area at any time with the [sidebar icon](#zeige-lernen) at the top of this area. Then only the slim “🎓 Learn” strip stays on the left; click it to open the area again. It stays open next to the editor so you can try out right away what you read. ## Insert an element diff --git a/web/lessons/pt/02-der-editor.md b/web/lessons/pt/02-der-editor.md index 8778228e..9b4ce2e4 100644 --- a/web/lessons/pt/02-der-editor.md +++ b/web/lessons/pt/02-der-editor.md @@ -13,7 +13,7 @@ O editor tem quatro áreas. Passa o rato por cima de uma palavra azul ou toca ne - **Ao meio, o [estrutograma](#zeige-struktogramm):** Um diagrama novo contém apenas um marcador vazio, assinalado com **ø**. - **Em baixo, o [Inspetor de objetos](#zeige-objektinspektor):** Aqui editas o texto do elemento selecionado. -> Podes mostrar e ocultar esta área de aprendizagem a qualquer momento com [Aprender](#zeige-lernen) na barra de ferramentas. Ela fica aberta ao lado do editor, para poderes experimentar logo o que lês. +> Podes recolher esta área de aprendizagem a qualquer momento com o [ícone da barra lateral](#zeige-lernen) no topo desta área. Fica só a barra estreita “🎓 Aprender” à esquerda; um clique abre-a de novo. Ela fica aberta ao lado do editor, para poderes experimentar logo o que lês. ## Inserir um elemento diff --git a/web/src/i18n/ar.strings b/web/src/i18n/ar.strings index ee12087a..8f2195b4 100644 --- a/web/src/i18n/ar.strings +++ b/web/src/i18n/ar.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "الشيفرة المباشرة"; -"web_live_toggle_title" = "عرض شيفرة مباشرة بجانب المخطط"; "web_live_hide" = "إخفاء الشيفرة المباشرة"; "web_live_show" = "إظهار الشيفرة المباشرة"; "web_live_resize" = "تغيير عرض منطقة الشيفرة (نقر مزدوج: إعادة تعيين)"; diff --git a/web/src/i18n/da.strings b/web/src/i18n/da.strings index 4d7488d8..1a5587a1 100644 --- a/web/src/i18n/da.strings +++ b/web/src/i18n/da.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Live-kode"; -"web_live_toggle_title" = "Vis kode live ved siden af diagrammet"; "web_live_hide" = "Skjul live-kode"; "web_live_show" = "Vis live-kode"; "web_live_resize" = "Skift kodeområdets bredde (dobbeltklik: nulstil)"; diff --git a/web/src/i18n/de.strings b/web/src/i18n/de.strings index 3ee0fedb..4620f65e 100644 --- a/web/src/i18n/de.strings +++ b/web/src/i18n/de.strings @@ -45,7 +45,6 @@ /* Lernbereich (Lektionen gibt es vorerst nur auf Deutsch) */ "web_learn_title" = "Lernen"; -"web_learn_toggle_title" = "Lektionen, Aufgaben und Nachschlagen ein- oder ausblenden"; "web_learn_hide" = "Lernbereich einklappen"; "web_learn_show" = "Lernbereich aufklappen: Lektionen, Aufgaben und Nachschlagen"; "web_learn_lessons" = "Lektionen"; @@ -108,7 +107,6 @@ /* Code live */ "web_live_title" = "Code live"; -"web_live_toggle_title" = "Code live neben dem Struktogramm anzeigen"; "web_live_hide" = "Code live ausblenden"; "web_live_show" = "Code live aufklappen"; "web_live_resize" = "Breite des Codebereichs ändern (Doppelklick: zurücksetzen)"; diff --git a/web/src/i18n/el.strings b/web/src/i18n/el.strings index 9c1a925f..cf54b9bb 100644 --- a/web/src/i18n/el.strings +++ b/web/src/i18n/el.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Ζωντανός κώδικας"; -"web_live_toggle_title" = "Εμφάνιση κώδικα ζωντανά δίπλα στο διάγραμμα"; "web_live_hide" = "Απόκρυψη ζωντανού κώδικα"; "web_live_show" = "Εμφάνιση ζωντανού κώδικα"; "web_live_resize" = "Αλλαγή πλάτους περιοχής κώδικα (διπλό κλικ: επαναφορά)"; diff --git a/web/src/i18n/en.strings b/web/src/i18n/en.strings index a71ea0e6..93276b13 100644 --- a/web/src/i18n/en.strings +++ b/web/src/i18n/en.strings @@ -45,7 +45,6 @@ /* Learning area (lessons are German only for now) */ "web_learn_title" = "Learn"; -"web_learn_toggle_title" = "Show or hide lessons, exercises and reference"; "web_learn_hide" = "Collapse the learning area"; "web_learn_show" = "Expand the learning area: lessons, exercises and reference"; "web_learn_lessons" = "Lessons"; @@ -108,7 +107,6 @@ /* Code live */ "web_live_title" = "Live code"; -"web_live_toggle_title" = "Show code live next to the diagram"; "web_live_hide" = "Hide live code"; "web_live_show" = "Show live code"; "web_live_resize" = "Change width of the code area (double-click: reset)"; diff --git a/web/src/i18n/es.strings b/web/src/i18n/es.strings index 05bd23df..c29022ff 100644 --- a/web/src/i18n/es.strings +++ b/web/src/i18n/es.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Código en vivo"; -"web_live_toggle_title" = "Mostrar el código en vivo junto al diagrama"; "web_live_hide" = "Ocultar código en vivo"; "web_live_show" = "Mostrar código en vivo"; "web_live_resize" = "Cambiar el ancho del área de código (doble clic: restablecer)"; diff --git a/web/src/i18n/fr.strings b/web/src/i18n/fr.strings index 32a9b950..a469de5e 100644 --- a/web/src/i18n/fr.strings +++ b/web/src/i18n/fr.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Code en direct"; -"web_live_toggle_title" = "Afficher le code en direct à côté du diagramme"; "web_live_hide" = "Masquer le code en direct"; "web_live_show" = "Afficher le code en direct"; "web_live_resize" = "Modifier la largeur de la zone de code (double-clic : réinitialiser)"; diff --git a/web/src/i18n/he.strings b/web/src/i18n/he.strings index b7eed272..52dc3612 100644 --- a/web/src/i18n/he.strings +++ b/web/src/i18n/he.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "קוד חי"; -"web_live_toggle_title" = "הצגת קוד בזמן אמת ליד התרשים"; "web_live_hide" = "הסתרת קוד חי"; "web_live_show" = "הצגת קוד חי"; "web_live_resize" = "שינוי רוחב אזור הקוד (לחיצה כפולה: איפוס)"; diff --git a/web/src/i18n/it.strings b/web/src/i18n/it.strings index 67e73e80..8a2ae968 100644 --- a/web/src/i18n/it.strings +++ b/web/src/i18n/it.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Codice dal vivo"; -"web_live_toggle_title" = "Mostra il codice dal vivo accanto al diagramma"; "web_live_hide" = "Nascondi codice dal vivo"; "web_live_show" = "Mostra codice dal vivo"; "web_live_resize" = "Modifica la larghezza dell’area codice (doppio clic: ripristina)"; diff --git a/web/src/i18n/ja.strings b/web/src/i18n/ja.strings index b2e463cc..9db93392 100644 --- a/web/src/i18n/ja.strings +++ b/web/src/i18n/ja.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "ライブコード"; -"web_live_toggle_title" = "図の横にコードをライブ表示"; "web_live_hide" = "ライブコードを隠す"; "web_live_show" = "ライブコードを表示"; "web_live_resize" = "コード領域の幅を変更(ダブルクリック:リセット)"; diff --git a/web/src/i18n/ko.strings b/web/src/i18n/ko.strings index df76a9ec..05068561 100644 --- a/web/src/i18n/ko.strings +++ b/web/src/i18n/ko.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "실시간 코드"; -"web_live_toggle_title" = "다이어그램 옆에 코드를 실시간으로 표시"; "web_live_hide" = "실시간 코드 숨기기"; "web_live_show" = "실시간 코드 표시"; "web_live_resize" = "코드 영역 너비 변경(더블클릭: 초기화)"; diff --git a/web/src/i18n/nb.strings b/web/src/i18n/nb.strings index ffce6b5e..57739c2b 100644 --- a/web/src/i18n/nb.strings +++ b/web/src/i18n/nb.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Live-kode"; -"web_live_toggle_title" = "Vis kode live ved siden av diagrammet"; "web_live_hide" = "Skjul live-kode"; "web_live_show" = "Vis live-kode"; "web_live_resize" = "Endre bredden på kodeområdet (dobbeltklikk: tilbakestill)"; diff --git a/web/src/i18n/nl.strings b/web/src/i18n/nl.strings index 9332d050..895c6a9a 100644 --- a/web/src/i18n/nl.strings +++ b/web/src/i18n/nl.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Live code"; -"web_live_toggle_title" = "Code live naast het diagram tonen"; "web_live_hide" = "Live code verbergen"; "web_live_show" = "Live code tonen"; "web_live_resize" = "Breedte van het codegebied wijzigen (dubbelklik: herstellen)"; diff --git a/web/src/i18n/pl.strings b/web/src/i18n/pl.strings index 45647028..4400dfcb 100644 --- a/web/src/i18n/pl.strings +++ b/web/src/i18n/pl.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Kod na żywo"; -"web_live_toggle_title" = "Pokaż kod na żywo obok diagramu"; "web_live_hide" = "Ukryj kod na żywo"; "web_live_show" = "Pokaż kod na żywo"; "web_live_resize" = "Zmień szerokość obszaru kodu (dwuklik: resetuj)"; diff --git a/web/src/i18n/pt-PT.strings b/web/src/i18n/pt-PT.strings index c44d9bed..520740ce 100644 --- a/web/src/i18n/pt-PT.strings +++ b/web/src/i18n/pt-PT.strings @@ -43,7 +43,6 @@ "web_run_error" = "Erro durante a execução."; "web_run_dropped_fmt" = "… %d linhas anteriores ocultas"; "web_learn_title" = "Aprender"; -"web_learn_toggle_title" = "Mostrar ou ocultar lições, exercícios e consulta"; "web_learn_hide" = "Recolher a área de aprendizagem"; "web_learn_show" = "Expandir a área de aprendizagem: lições, exercícios e consulta"; "web_learn_lessons" = "Lições"; @@ -106,7 +105,6 @@ /* Code live */ "web_live_title" = "Código ao vivo"; -"web_live_toggle_title" = "Mostrar o código ao vivo ao lado do diagrama"; "web_live_hide" = "Ocultar código ao vivo"; "web_live_show" = "Mostrar código ao vivo"; "web_live_resize" = "Alterar a largura da área de código (duplo clique: repor)"; diff --git a/web/src/i18n/ru.strings b/web/src/i18n/ru.strings index 9fe4473a..30522671 100644 --- a/web/src/i18n/ru.strings +++ b/web/src/i18n/ru.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Код вживую"; -"web_live_toggle_title" = "Показывать код вживую рядом с диаграммой"; "web_live_hide" = "Скрыть код вживую"; "web_live_show" = "Показать код вживую"; "web_live_resize" = "Изменить ширину области кода (двойной щелчок: сбросить)"; diff --git a/web/src/i18n/sv.strings b/web/src/i18n/sv.strings index 54cd740d..ce33fe0a 100644 --- a/web/src/i18n/sv.strings +++ b/web/src/i18n/sv.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Live-kod"; -"web_live_toggle_title" = "Visa kod live bredvid diagrammet"; "web_live_hide" = "Dölj live-kod"; "web_live_show" = "Visa live-kod"; "web_live_resize" = "Ändra kodområdets bredd (dubbelklick: återställ)"; diff --git a/web/src/i18n/tr.strings b/web/src/i18n/tr.strings index 23fa681f..03df6449 100644 --- a/web/src/i18n/tr.strings +++ b/web/src/i18n/tr.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Canlı kod"; -"web_live_toggle_title" = "Kodu diyagramın yanında canlı göster"; "web_live_hide" = "Canlı kodu gizle"; "web_live_show" = "Canlı kodu göster"; "web_live_resize" = "Kod alanının genişliğini değiştir (çift tıklama: sıfırla)"; diff --git a/web/src/i18n/uk.strings b/web/src/i18n/uk.strings index 8b2c5cd0..714b693e 100644 --- a/web/src/i18n/uk.strings +++ b/web/src/i18n/uk.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "Код наживо"; -"web_live_toggle_title" = "Показувати код наживо поруч із діаграмою"; "web_live_hide" = "Сховати код наживо"; "web_live_show" = "Показати код наживо"; "web_live_resize" = "Змінити ширину області коду (подвійний клік: скинути)"; diff --git a/web/src/i18n/zh-Hans.strings b/web/src/i18n/zh-Hans.strings index 45d26803..4ebd1668 100644 --- a/web/src/i18n/zh-Hans.strings +++ b/web/src/i18n/zh-Hans.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "实时代码"; -"web_live_toggle_title" = "在图旁实时显示代码"; "web_live_hide" = "隐藏实时代码"; "web_live_show" = "显示实时代码"; "web_live_resize" = "更改代码区宽度(双击:重置)"; diff --git a/web/src/i18n/zh-Hant.strings b/web/src/i18n/zh-Hant.strings index 4656148f..23486d23 100644 --- a/web/src/i18n/zh-Hant.strings +++ b/web/src/i18n/zh-Hant.strings @@ -50,7 +50,6 @@ /* Code live */ "web_live_title" = "即時程式碼"; -"web_live_toggle_title" = "在圖旁即時顯示程式碼"; "web_live_hide" = "隱藏即時程式碼"; "web_live_show" = "顯示即時程式碼"; "web_live_resize" = "變更程式碼區寬度(按兩下:重設)"; diff --git a/web/src/ui/app.ts b/web/src/ui/app.ts index 54c10e38..8251ac8c 100644 --- a/web/src/ui/app.ts +++ b/web/src/ui/app.ts @@ -221,8 +221,6 @@ export class App { private exportSelect!: HTMLSelectElement private learn: LearnPanel private shell: HTMLElement - private learning = false - private learnButton?: HTMLButtonElement private railButton?: HTMLButtonElement private liveRailButton?: HTMLButtonElement private exerciseSaveTimer?: number @@ -238,7 +236,6 @@ export class App { /** Ansicht „Code live“ rechts neben dem Editor. */ private liveCoding = false private live: LiveCodePanel - private liveButton?: HTMLButtonElement private measure = createCanvasMeasure() private metrics = diagramDisplayMetrics(true) @@ -340,8 +337,6 @@ export class App { .join('')}
- -
@@ -415,12 +410,6 @@ export class App { list.append(li) } - this.learnButton = $('[data-action=learn]') - this.learnButton.addEventListener('click', () => this.setLearning(!this.learning)) - this.learnButton.setAttribute('aria-pressed', String(this.learning)) - this.liveButton = $('[data-action=live]') - this.liveButton.addEventListener('click', () => this.setLiveCoding(!this.liveCoding)) - this.liveButton.setAttribute('aria-pressed', String(this.liveCoding)) this.tabStrip = $('.tabs') this.exportSelect = $('[data-action=export]') this.exportSelect.addEventListener('change', () => { @@ -497,9 +486,7 @@ export class App { // MARK: - Lernbereich private setLearning(on: boolean, remember = true) { - this.learning = on this.shell.classList.toggle('learning', on) - this.learnButton?.setAttribute('aria-pressed', String(on)) if (remember) storeValue(learnKey, on ? '1' : '0') if (this.canvasHost) this.renderDiagramOnly() } @@ -869,7 +856,6 @@ export class App { if (on && this.coding) this.setCoding(false) this.liveCoding = on this.shell.classList.toggle('live', on) - this.liveButton?.setAttribute('aria-pressed', String(on)) storeValue(liveKey, on ? '1' : '0') if (this.canvasHost) this.render() } diff --git a/web/src/ui/styles.css b/web/src/ui/styles.css index 64b4e6e3..7fb104a9 100644 --- a/web/src/ui/styles.css +++ b/web/src/ui/styles.css @@ -830,7 +830,7 @@ button.danger-text:not(:disabled) { writing-mode: vertical-rl; white-space: nowrap; } -.shell.learning .learn-rail { +.shell.learning .learn-rail:not(.live-rail) { display: none; } /* Code live eingeklappt: dieselbe Leiste, nur am rechten Rand. */ @@ -1224,10 +1224,6 @@ button.danger-text:not(:disabled) { gap: 8px; margin-top: 18px; } -button[data-action='learn'][aria-pressed='true'] { - border-color: var(--accent); - background: var(--accent-soft); -} @media (max-width: 1100px) { .learn { width: 340px; @@ -1330,10 +1326,6 @@ button[data-action='learn'][aria-pressed='true'] { .live-resizer:focus-visible { outline: none; } -button[data-action='live'][aria-pressed='true'] { - border-color: var(--accent); - background: var(--accent-soft); -} @media (max-width: 1100px) { .livecode { width: 340px; diff --git a/web/src/ui/termTips.ts b/web/src/ui/termTips.ts index 36f1dfa2..72401827 100644 --- a/web/src/ui/termTips.ts +++ b/web/src/ui/termTips.ts @@ -138,7 +138,7 @@ export const uiTargets: Record = { exportieren: '[data-action=export]', rueckgaengig: '[data-action=undo]', textgroesse: '[data-action=zoom]', - lernen: '[data-action=learn]', + lernen: '.learn .learn-hide', code: '[data-action=code]', simulation: '[data-action=simulate]', } diff --git a/website/app/assets/ar-CvVmBZfx.js b/website/app/assets/ar-COQZmxPT.js similarity index 97% rename from website/app/assets/ar-CvVmBZfx.js rename to website/app/assets/ar-COQZmxPT.js index 808b0a2e..5d86f041 100644 --- a/website/app/assets/ar-CvVmBZfx.js +++ b/website/app/assets/ar-COQZmxPT.js @@ -50,7 +50,6 @@ const e=`/* نصوص موجودة في نسخة الويب فقط. أما بقي /* Code live */ "web_live_title" = "الشيفرة المباشرة"; -"web_live_toggle_title" = "عرض شيفرة مباشرة بجانب المخطط"; "web_live_hide" = "إخفاء الشيفرة المباشرة"; "web_live_show" = "إظهار الشيفرة المباشرة"; "web_live_resize" = "تغيير عرض منطقة الشيفرة (نقر مزدوج: إعادة تعيين)"; diff --git a/website/app/assets/da-DsSrdnBT.js b/website/app/assets/da-Chd6sURw.js similarity index 97% rename from website/app/assets/da-DsSrdnBT.js rename to website/app/assets/da-Chd6sURw.js index b33045dc..7233ab9a 100644 --- a/website/app/assets/da-DsSrdnBT.js +++ b/website/app/assets/da-Chd6sURw.js @@ -50,7 +50,6 @@ const e=`/* Tekster, der kun findes i webversionen. Alt andet kommer fra appens /* Code live */ "web_live_title" = "Live-kode"; -"web_live_toggle_title" = "Vis kode live ved siden af diagrammet"; "web_live_hide" = "Skjul live-kode"; "web_live_show" = "Vis live-kode"; "web_live_resize" = "Skift kodeområdets bredde (dobbeltklik: nulstil)"; diff --git a/website/app/assets/de-CqCSi5uB.js b/website/app/assets/de-BqSJbBFG.js similarity index 97% rename from website/app/assets/de-CqCSi5uB.js rename to website/app/assets/de-BqSJbBFG.js index 5d70c99a..c8b62cd7 100644 --- a/website/app/assets/de-CqCSi5uB.js +++ b/website/app/assets/de-BqSJbBFG.js @@ -45,7 +45,6 @@ const e=`/* Texte, die es nur in der Web-Version gibt. Alle anderen kommen aus d /* Lernbereich (Lektionen gibt es vorerst nur auf Deutsch) */ "web_learn_title" = "Lernen"; -"web_learn_toggle_title" = "Lektionen, Aufgaben und Nachschlagen ein- oder ausblenden"; "web_learn_hide" = "Lernbereich einklappen"; "web_learn_show" = "Lernbereich aufklappen: Lektionen, Aufgaben und Nachschlagen"; "web_learn_lessons" = "Lektionen"; @@ -108,7 +107,6 @@ const e=`/* Texte, die es nur in der Web-Version gibt. Alle anderen kommen aus d /* Code live */ "web_live_title" = "Code live"; -"web_live_toggle_title" = "Code live neben dem Struktogramm anzeigen"; "web_live_hide" = "Code live ausblenden"; "web_live_show" = "Code live aufklappen"; "web_live_resize" = "Breite des Codebereichs ändern (Doppelklick: zurücksetzen)"; diff --git a/website/app/assets/el-DrfOXLmq.js b/website/app/assets/el-C7O2XkiD.js similarity index 97% rename from website/app/assets/el-DrfOXLmq.js rename to website/app/assets/el-C7O2XkiD.js index f67520fc..294a28e9 100644 --- a/website/app/assets/el-DrfOXLmq.js +++ b/website/app/assets/el-C7O2XkiD.js @@ -50,7 +50,6 @@ const e=`/* Κείμενα που υπάρχουν μόνο στην έκδοσ /* Code live */ "web_live_title" = "Ζωντανός κώδικας"; -"web_live_toggle_title" = "Εμφάνιση κώδικα ζωντανά δίπλα στο διάγραμμα"; "web_live_hide" = "Απόκρυψη ζωντανού κώδικα"; "web_live_show" = "Εμφάνιση ζωντανού κώδικα"; "web_live_resize" = "Αλλαγή πλάτους περιοχής κώδικα (διπλό κλικ: επαναφορά)"; diff --git a/website/app/assets/en-DAKqKtlO.js b/website/app/assets/en-BU37XAsV.js similarity index 97% rename from website/app/assets/en-DAKqKtlO.js rename to website/app/assets/en-BU37XAsV.js index 43ae0707..b7a11b2d 100644 --- a/website/app/assets/en-DAKqKtlO.js +++ b/website/app/assets/en-BU37XAsV.js @@ -45,7 +45,6 @@ const e=`/* Texts that exist only in the web version. Everything else comes from /* Learning area (lessons are German only for now) */ "web_learn_title" = "Learn"; -"web_learn_toggle_title" = "Show or hide lessons, exercises and reference"; "web_learn_hide" = "Collapse the learning area"; "web_learn_show" = "Expand the learning area: lessons, exercises and reference"; "web_learn_lessons" = "Lessons"; @@ -108,7 +107,6 @@ const e=`/* Texts that exist only in the web version. Everything else comes from /* Code live */ "web_live_title" = "Live code"; -"web_live_toggle_title" = "Show code live next to the diagram"; "web_live_hide" = "Hide live code"; "web_live_show" = "Show live code"; "web_live_resize" = "Change width of the code area (double-click: reset)"; diff --git a/website/app/assets/es-CC-_nS8U.js b/website/app/assets/es-DcQytQNI.js similarity index 97% rename from website/app/assets/es-CC-_nS8U.js rename to website/app/assets/es-DcQytQNI.js index c92b2825..a6a7a1e0 100644 --- a/website/app/assets/es-CC-_nS8U.js +++ b/website/app/assets/es-DcQytQNI.js @@ -50,7 +50,6 @@ const e=`/* Textos que solo existen en la versión web. Todo lo demás procede d /* Code live */ "web_live_title" = "Código en vivo"; -"web_live_toggle_title" = "Mostrar el código en vivo junto al diagrama"; "web_live_hide" = "Ocultar código en vivo"; "web_live_show" = "Mostrar código en vivo"; "web_live_resize" = "Cambiar el ancho del área de código (doble clic: restablecer)"; diff --git a/website/app/assets/fr-xxMJQhld.js b/website/app/assets/fr-0goWcne4.js similarity index 97% rename from website/app/assets/fr-xxMJQhld.js rename to website/app/assets/fr-0goWcne4.js index 0eba2843..a52bacc3 100644 --- a/website/app/assets/fr-xxMJQhld.js +++ b/website/app/assets/fr-0goWcne4.js @@ -50,7 +50,6 @@ const e=`/* Textes propres à la version web. Tout le reste provient des Localiz /* Code live */ "web_live_title" = "Code en direct"; -"web_live_toggle_title" = "Afficher le code en direct à côté du diagramme"; "web_live_hide" = "Masquer le code en direct"; "web_live_show" = "Afficher le code en direct"; "web_live_resize" = "Modifier la largeur de la zone de code (double-clic : réinitialiser)"; diff --git a/website/app/assets/he-D_sMncu9.js b/website/app/assets/he-iK8j7NgI.js similarity index 97% rename from website/app/assets/he-D_sMncu9.js rename to website/app/assets/he-iK8j7NgI.js index 515a1231..3497e7d0 100644 --- a/website/app/assets/he-D_sMncu9.js +++ b/website/app/assets/he-iK8j7NgI.js @@ -50,7 +50,6 @@ const e=`/* טקסטים שקיימים רק בגרסת הרשת. כל השאר /* Code live */ "web_live_title" = "קוד חי"; -"web_live_toggle_title" = "הצגת קוד בזמן אמת ליד התרשים"; "web_live_hide" = "הסתרת קוד חי"; "web_live_show" = "הצגת קוד חי"; "web_live_resize" = "שינוי רוחב אזור הקוד (לחיצה כפולה: איפוס)"; diff --git a/website/app/assets/index-DxIR6zjj.js b/website/app/assets/index-07bmFCF5.js similarity index 97% rename from website/app/assets/index-DxIR6zjj.js rename to website/app/assets/index-07bmFCF5.js index 8b6df333..eea8f219 100644 --- a/website/app/assets/index-DxIR6zjj.js +++ b/website/app/assets/index-07bmFCF5.js @@ -1,4 +1,4 @@ -var Za=Object.defineProperty;var _a=(a,e,t)=>e in a?Za(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var b=(a,e,t)=>_a(a,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var g=(a=>(a[a.anweisung=0]="anweisung",a[a.verzweigung=1]="verzweigung",a[a.fallauswahl=2]="fallauswahl",a[a.forSchleife=3]="forSchleife",a[a.whileSchleife=4]="whileSchleife",a[a.doUntilSchleife=5]="doUntilSchleife",a[a.endlosschleife=6]="endlosschleife",a[a.aussprung=7]="aussprung",a[a.aufruf=8]="aufruf",a[a.leerElement=9]="leerElement",a))(g||{});function ja(a){return a===3||a===4||a===5||a===6}function Pa(a){return a===1||a===2}function K(a,e={}){return{type:a,zoomX:0,zoomY:0,textLines:[""],...e}}function Ca(a){const e=a.textLines;if(!e.every(t=>t.trim()===""))switch(a.type){case g.forSchleife:return e.length<=1?e:[Ta(e)];case g.verzweigung:return Ne("if",e);case g.whileSchleife:return Ne("while",e);case g.doUntilSchleife:return Ne("while",Aa(e));case g.fallauswahl:return Ne("switch",e);default:return e}}function Aa(a){if(a.length===0)return a;const e=a[0].trim(),t=e.toLowerCase(),n=[...a];if(t==="until")n[0]="";else if(t.startsWith("until "))n[0]=e.slice(6).trim();else if(t.startsWith("until("))n[0]=e.slice(5);else return a;return n}function ft(a){const e=new Set(["if","for","while","until","switch"]),t=["input:","output:","print:"],n=a.trim(),i=n.toLowerCase();for(const o of t){if(i===o)return{keyword:n,rest:""};if(i.startsWith(o+" "))return{keyword:n.slice(0,o.length),rest:n.slice(o.length).trim()}}const s=n.indexOf(" ");if(s<0)return;const r=n.slice(0,s);if(e.has(r.toLowerCase()))return{keyword:r,rest:n.slice(s+1).trim()}}function Ne(a,e){if(e.length===0)return e;const t=e[0].trim(),n=t.toLowerCase();if(n===a||n.startsWith(a+" "))return e;const i=[...e];return i[0]=a+" "+t,i}function Ta(a){let e=[...a];for(;e.length<3;)e.push("");e=e.slice(0,3);const t=i=>{let s=i.trim();for(;s.endsWith(";");)s=s.slice(0,-1).trim();return s},n=e.map(t).join("; ").trim();return n===""?"for":"for "+n}const yn={[g.anweisung]:"Anweisung",[g.verzweigung]:"Bedingung",[g.fallauswahl]:"Fallauswahl",[g.forSchleife]:"for 0 < i < anzahl",[g.whileSchleife]:"while …",[g.doUntilSchleife]:"while …",[g.endlosschleife]:"endless",[g.aussprung]:"break",[g.aufruf]:"Aufruf()",[g.leerElement]:"ø"};function Da(a){Object.assign(yn,a)}function tt(a){return Ca(a)??[yn[a.type]]}class E extends Error{}const se=a=>structuredClone(a);function Te(){return K(g.anweisung,{textLines:["ø"]})}function Wa(){return{caption:"",elements:[Te()]}}function nt(a){if(a.type===g.leerElement)return!0;if(a.type===g.anweisung){const e=a.textLines;return e.length===0||e.length===1&&e[0]==="ø"}return!1}function ve(a,e){const t=$(a,e);return t!==void 0&&nt(t)}function Ge(a,e){if(e.length===0)throw new E("Invalid element path.");const[t,...n]=e;if(t<0||t>=a.length)throw new E("Invalid element path.");if(n.length===0)return{list:a,index:t};const[i,...s]=n;if(s.length===0)throw new E("Invalid element path.");return Ge(zn(a[t],i),s)}function zn(a,e){if(ja(a.type)){if(e!==0||!a.loopBody)throw new E("Invalid element path.");return a.loopBody}if(Pa(a.type)){if(!a.cases||e<0||e>=a.cases.length)throw new E("Invalid element path.");return a.cases[e].elements}throw new E("Invalid element path.")}function ne(a,e){const{list:t,index:n}=Ge(a.elements,e);return t[n]}function $(a,e){try{return ne(a,e)}catch{return}}function ge(a,e,t){const n=se(a),{list:i,index:s}=Ge(n.elements,e);return i[s]=se(t),n}function w1(a,e,t){const n=se(ne(a,e));return n.textLines=t.length===0?[""]:t,ge(a,e,n)}function S1(a,e){return e.length===0?!1:e.length===1&&a.elements.length===1?!ve(a,e):$(a,e)!==void 0}function De(a,e){const t=se(a),{list:n,index:i}=Ge(t.elements,e);if(e.length===1&&n.length===1){if(nt(n[0]))throw new E("The last root element cannot be deleted.");return n[0]=Te(),t}return n.splice(i,1),e.length>1&&n.length===0&&n.push(Te()),t}function _e(a,e,t,n){const i=se(a);let s;if(e.length===0)s=i.elements;else{const r=e.slice(0,-1),o=e[e.length-1],{list:l,index:m}=Ge(i.elements,r);s=zn(l[m],o)}return s.splice(Math.min(Math.max(0,t),s.length),0,se(n)),i}function vn(a,e,t){if(t.length===0)throw new E("Invalid element path.");return _e(a,t.slice(0,-1),t[t.length-1],e)}function G1(a,e,t){if(t.length===0)throw new E("Invalid element path.");return _e(a,t.slice(0,-1),t[t.length-1]+1,e)}function at(a,e){return a.lengthe[n]===t)}function it(a,e){if(e.length===0)return a;const t=e[e.length-1],n=e.slice(0,-1);if(a.length<=n.length||!n.every((r,o)=>a[o]===r))return a;const i=n.length;if(a[i]<=t)return a;const s=[...a];return s[i]-=1,s}const st=(a,e)=>a.length===e.length&&a.every((t,n)=>t===e[n]);function Ba(a,e,t){if(st(e,t))return a;if(at(e,t))throw new E("Invalid element path.");const n=ne(a,e),i=De(a,e);return vn(i,n,it(t,e))}function Ga(a,e,t){if(st(e,t))return a;if(at(e,t))throw new E("Invalid element path.");const n=ne(a,e),i=De(a,e);return G1(i,n,it(t,e))}function Ha(a,e,t){if(!ve(a,t))throw new E("Invalid element path.");if(st(e,t))return a;if(at(e,t))throw new E("Invalid element path.");const n=ne(a,e),i=De(a,e);return ge(i,it(t,e),n)}function Na(a,e){const t=se(ne(a,e)),n=t.cases;if(t.type!==g.fallauswahl||!n||n.length===0)throw new E("Invalid element path.");const i=n[n.length-1].name.toLowerCase()==="default",s=i?n.length-1:n.length,r=String(i?n.length:n.length+1);return n.splice(s,0,{name:r,elements:[Te()]}),{doc:ge(a,e,t),path:[...e,s,0]}}function Ea(a,e,t){const n=se(ne(a,e)),i=n.cases;if(n.type!==g.fallauswahl||!i)throw new E("Invalid element path.");if(i.length<=2)throw new E("A switch needs at least two cases.");if(t<0||t>=i.length)throw new E("Invalid element path.");i.splice(t,1);const s=Math.min(t,i.length-1);return{doc:ge(a,e,n),path:[...e,s,0]}}function La(a,e,t,n){const i=se(ne(a,e)),s=i.cases;if(i.type!==g.fallauswahl||!s)throw new E("Invalid element path.");if(t<0||t>=s.length)throw new E("Invalid element path.");const r=n.trim();if(r==="")throw new E("Invalid element path.");return s[t].name=r,ge(a,e,i)}function Va(a,e){var t;if(!(!a||a.length===0))for(let n=a.length;n>=1;n--){const i=a.slice(0,n);if(((t=$(e,i))==null?void 0:t.type)===g.fallauswahl)return i}}function Ra(a,e){if(!(!a||a.length<=e.length))return a[e.length]}function yt(a,e){if(e.elements.length!==0)return!a||!$(e,a)?[0]:a}const wn=a=>a!==void 0&&/\s/.test(a);function a1(a){const e=a.trim().toLowerCase();return e.startsWith("input:")?"input":e.startsWith("output:")||e.startsWith("print:")?"output":"statement"}function Ua(a){const e=a.trim(),t=e.toLowerCase();return t.startsWith("input:")?e.slice(6).trim():t.startsWith("output:")?e.slice(7).trim():t.startsWith("print:")?e.slice(6).trim():a}function zt(a,e){const t=e.trim();return t===""?`${a} `:`${a} ${t}`}function Fa(a,e){const t=Ua(e);switch(a){case"statement":return t;case"input":return zt("input:",t);case"output":return zt("output:",t)}}const qe=a=>wn(a[0])?a.slice(1):a;function Ya(a){const e=a.replace(/^\s+/,""),t=e.toLowerCase();return t.startsWith("input:")?qe(e.slice(6)):t.startsWith("output:")?qe(e.slice(7)):t.startsWith("print:")?qe(e.slice(6)):a}function vt(a,e){const t=e.replace(/^\s+/,"");if(!t.toLowerCase().startsWith(a.toLowerCase()))return e;const n=t.slice(a.length);if(!(n===""||wn(n[0])||n[0]==="("))return e;const i=qe(n);return i.startsWith("(")&&i.endsWith(")")&&i.length>=2?i.slice(1,-1):i}function wt(a,e){if(a==="input:"||a==="output:")return Ya(e);const t=vt(a,e);if(a==="while"&&t===e){const n=vt("until",e);if(n!==e)return n}return t}function Oa(a,e){return e===""?`${a} `:`${a} ${e}`}function Sn(a){return a.replace(/[“”„«»]/g,'"').replace(/[’‘‚´]/g,"'")}function St(a){const e=a.length===0?[""]:a.slice(0,3);for(;e.length<3;)e.push("");return e}function Qa(a){let e=Sn(a);for(;;){const t=e.trim();if(!t.endsWith(";"))return e;e=t.slice(0,-1).trim()}}const p1='system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';function Xa(a,e){return`${e==="bold"?700:500} ${a}px ${p1}`}const kn=(a,e,t)=>[...a].length*e*(t==="bold"?.68:.62);function Ja(){if(typeof document>"u"||!document.body)return;const a="http://www.w3.org/2000/svg",e=document.createElementNS(a,"svg");e.setAttribute("aria-hidden","true"),e.setAttribute("width","0"),e.setAttribute("height","0"),e.style.cssText="position:absolute;left:-9999px;top:0;visibility:hidden;overflow:hidden";const t=document.createElementNS(a,"text");if(t.setAttribute("font-family",p1),t.style.whiteSpace="pre",e.append(t),document.body.append(e),typeof t.getComputedTextLength!="function"||typeof t.getBBox!="function"){e.remove();return}if(t.textContent="Mg",t.setAttribute("font-size","20"),!(t.getComputedTextLength()>0)){e.remove();return}return t}let k1;function Mn(){return k1===void 0&&(k1=Ja()??null),k1??void 0}function Zn(a,e,t){a.setAttribute("font-size",String(e)),a.setAttribute("font-weight",t==="bold"?"700":"500")}function kt(a,e){const t=`${a}|${e}`;let n=Mt.get(t);if(!n){const i=Mn();if(n={ascent:a*.95,descent:a*.24},i){Zn(i,a,e),i.setAttribute("y","0"),i.textContent="Mg";const s=i.getBBox();s.height>0&&(n={ascent:-s.y,descent:s.height+s.y})}Mt.set(t,n)}return n}const Mt=new Map;function qa(){const a=Mn();if(a){const n=new Map;return(i,s,r)=>{const o=`${s}|${r}|${i}`;let l=n.get(o);return l===void 0&&(Zn(a,s,r),a.textContent=i,l=i===""?0:a.getComputedTextLength(),n.size>2e3&&n.clear(),n.set(o,l)),l}}const e=typeof document<"u"?document.createElement("canvas").getContext("2d"):null;if(!e)return kn;const t=new Map;return(n,i,s)=>{const r=`${i}|${s}|${n}`;let o=t.get(r);return o===void 0&&(e.font=Xa(i,s),o=e.measureText(n).width,t.size>2e3&&t.clear(),t.set(r,o)),o}}const _n={fontSize:15,lineHeight:20,charWidth:7,baseHeaderExtra:20,minSidePadding:42,cellTextInsetY:15,doUntilDoLabelTopInset:2,doUntilFooterTopInset:6,doUntilFooterBottomInset:8};function Ka(a){return{..._n,fontSize:14,lineHeight:21,charWidth:5.5*(14/12),baseHeaderExtra:21,minSidePadding:40}}const Ee=a=>a===g.forSchleife||a===g.whileSchleife||a===g.doUntilSchleife||a===g.endlosschleife,Le=a=>a===g.fallauswahl||a===g.verzweigung;function Ve(a,e,t,n=0){return{idPath:a,element:e,frame:t,headerBandHeight:n,topBandHeight:0,loopBodyLeadingInset:0,caseColumnFrames:[],children:[]}}function F(a){return{...a,frame:{...a.frame}}}class jn{constructor(e=_n,t=kn){this.metrics=e,this.measure=t}layout(e,t={left:28,top:28}){const i=this.layoutList(e.elements,t.left,t.top,[]).map(l=>this.stretchLoopBodiesVertically(l));let s=0,r=0;const o=l=>{s=Math.max(s,l.frame.x+l.frame.width),r=Math.max(r,l.frame.y+l.frame.height),l.children.forEach(o)};return i.forEach(o),{canvasSize:{width:s+t.left,height:r+t.top},elements:i}}lineWidth(e){return Math.ceil(this.measure(e,this.metrics.fontSize,"medium"))}lineWidthBold(e){return Math.ceil(this.measure(e,this.metrics.fontSize,"bold"))}layoutList(e,t,n,i){let s=[],r=n;e.forEach((l,m)=>{const u=this.layoutElement(l,t,r,[...i,m]);s.push(u),r+=u.frame.height});const o=Math.max(0,...s.map(l=>l.frame.width));return o>0&&(s=s.map(l=>this.stretchNodeTreeToWidth(l,o))),s}stretchMultiwayNodeToWidth(e,t){const n=F(e),i=n.frame.width;if(!(i>0)||n.caseColumnFrames.length===0)return n;const s=t/i;n.frame.width=t;let r=n.frame.x;const o=n.caseColumnFrames.map(l=>{const m=l.width*s,u={x:r,y:l.y,width:m,height:l.height};return r+=m,u});return n.caseColumnFrames=o,n.dividerX=o.length>0?o[o.length-1].x:n.frame.x+t,n.columns&&n.columns.length===o.length&&(n.columns=n.columns.map((l,m)=>{const u=o[m];return l.map(c=>{const h=F(c);return h.frame.x=u.x,h.frame.width=u.width,this.stretchDescendantsWidths(h,u.width)})}),n.children=n.columns.flat()),n}stretchLoopChildren(e,t){const n=this.effectiveLoopBodyLeading(e),i=Math.max(0,t-n);e.children=e.children.map(s=>{const r=F(s);return r.frame.x=e.frame.x+n,r.frame.width=i,this.stretchDescendantsWidths(r,i)})}stretchNodeTreeToWidth(e,t){const n=F(e);return n.frame.width>0?Le(n.element.type)&&n.caseColumnFrames.length>0?this.stretchMultiwayNodeToWidth(n,t):(n.frame.width=t,Ee(n.element.type)?this.stretchLoopChildren(n,t):n.children=n.children.map(s=>this.stretchDescendantsWidths(s,t)),n):n}stretchDescendantsWidths(e,t){let n=F(e);return Le(n.element.type)?n=this.stretchNodeTreeToWidth(n,t):Ee(n.element.type)?(n.frame.width=t,this.stretchLoopChildren(n,t)):(n.frame.width=t,n.children=n.children.map(i=>this.stretchDescendantsWidths(i,t))),n}stretchLoopBodiesVertically(e){const t=F(e);if(t.columns&&t.columns.length>0)return t.columns=t.columns.map(s=>s.map(r=>this.stretchLoopBodiesVertically(r))),t.children=t.columns.flat(),t;t.children=t.children.map(s=>this.stretchLoopBodiesVertically(s));const n=s=>s===g.anweisung||s===g.leerElement||s===g.aufruf||s===g.aussprung||Ee(s);let i;switch(t.element.type){case g.forSchleife:case g.whileSchleife:case g.endlosschleife:{const s=t.element.type===g.endlosschleife?40:0;i=t.frame.y+t.frame.height-s;break}case g.doUntilSchleife:i=t.frame.y+t.frame.height-t.headerBandHeight;break}if(i!==void 0&&t.children.length>0){const s=t.children.length-1;let r=F(t.children[s]);const o=i-(r.frame.y+r.frame.height);o>.5&&n(r.element.type)&&(r.frame.height+=o,r=this.stretchLoopBodiesVertically(r),t.children=[...t.children.slice(0,s),r])}return t}headerHeight(e){const t=this.metrics,n=Math.max(1,e.textLines.length);if(e.type===g.doUntilSchleife)return t.doUntilFooterTopInset+n*t.lineHeight+t.doUntilFooterBottomInset+e.zoomY;let i;switch(e.type){case g.fallauswahl:i=40;break;case g.verzweigung:i=20;break;case g.forSchleife:case g.whileSchleife:case g.endlosschleife:i=t.baseHeaderExtra+4;break;default:i=14}return i+n*t.lineHeight+e.zoomY}doUntilBodyLeadingInset(){return Math.max(20,this.lineWidthBold("do")+12)}effectiveLoopBodyLeading(e){return e.element.type===g.doUntilSchleife?e.loopBodyLeadingInset>0?e.loopBodyLeadingInset:this.doUntilBodyLeadingInset():20}horizontalPaddingInsideCell(e){return Le(e)?Math.max(100,this.metrics.minSidePadding*2.45):this.metrics.minSidePadding}minWidth(e){const t=e.textLines.length===0?0:Math.max(...e.textLines.map(s=>this.lineWidth(s)));let n=t+e.zoomX+this.horizontalPaddingInsideCell(e.type);if(e.type===g.aufruf){const s=Math.max(68,this.metrics.minSidePadding*1.7),r=Math.max(8,this.metrics.minSidePadding*.2);n=Math.max(n,t+e.zoomX+s+r)}const i=e.type===g.leerElement?76:e.type===g.aufruf?104:72;return Math.max(i,n)}layoutElement(e,t,n,i){if(Le(e.type))return this.layoutMultiway(e,t,n,i);if(Ee(e.type))return this.layoutLoop(e,t,n,i);const s=this.headerHeight(e);return Ve(i,e,{x:t,y:n,width:this.minWidth(e),height:s},s)}layoutLoop(e,t,n,i){const s=I=>I.reduce((v,w)=>v+w.frame.height,0),r=I=>Math.max(0,...I.map(v=>v.frame.width)),o=e.loopBody??[];if(e.type===g.doUntilSchleife){const I=this.doUntilBodyLeadingInset(),v=e.zoomY,w=this.headerHeight(e),j=this.layoutList(o,t+I,n+v,[...i,0]),_=Math.max(this.minWidth(e),r(j)+I),Z=s(j)+w+v,P=Math.max(0,_-I),C=Ve(i,e,{x:t,y:n,width:_,height:Z},w);return C.topBandHeight=v,C.loopBodyLeadingInset=I,C.children=j.map(W=>{const B=F(W);return B.frame.x=t+I,B.frame.width=P,this.stretchDescendantsWidths(B,P)}),C}const l=20,m=this.headerHeight(e),u=e.type===g.endlosschleife?40:0,c=this.layoutList(o,t+l,n+m,[...i,0]),h=Math.max(this.minWidth(e),r(c)+l),p=m+u+s(c),x=Math.max(0,h-l),y=Ve(i,e,{x:t,y:n,width:h,height:p},m);return y.children=c.map(I=>{const v=F(I);return v.frame.x=t+l,v.frame.width=x,this.stretchDescendantsWidths(v,x)}),y}layoutMultiway(e,t,n,i){const s=this.headerHeight(e),r=e.cases??[],o=Math.max(1,r.length),l=Math.max(this.minWidth(e)/o,132);let m=[],u=[],c=0,h=0;if(r.forEach((I,v)=>{const w=t+c,j=this.layoutList(I.elements,w,n+s,[...i,v]),_=Math.max(0,...j.map(C=>C.frame.width));let Z;e.type===g.verzweigung&&o===2?Z=Math.max(_,(v===0?"true":"false").length*this.metrics.charWidth+24):Z=Math.max(l,_);const P=j.reduce((C,W)=>C+W.frame.height,0);h=Math.max(h,P),m.push({x:w,y:n+s,width:Z,height:P}),u.push(j.map(C=>{const W=F(C);return W.frame.x=w,W.frame.width=Z,this.stretchDescendantsWidths(W,Z)})),c+=Z}),e.type===g.verzweigung&&o===2&&m.length===2){const I=Math.max(m[0].width,m[1].width),v=t,w=t+I,j=w-m[1].x;m[0]={...m[0],x:v,width:I},m[1]={...m[1],x:w,width:I},c=I*2,u[0]=u[0].map(_=>{const Z=F(_);return Z.frame.x=v,Z.frame.width=I,this.stretchDescendantsWidths(Z,I)}),u[1]=u[1].map(_=>{const Z=H1(_,j);return Z.frame.width=I,this.stretchDescendantsWidths(Z,I)})}if(u.length>0){const I=$a(u,n+s);u=I.columns.map(v=>v.map(w=>this.stretchLoopBodiesVertically(w)));for(let v=0;v0?Math.max(...I.columnHeights):h}let p=Math.max(c,this.minWidth(e));if(c>.5&&p>c+.5){const I=p/c;let v=t;const w=[],j=[];m.forEach((_,Z)=>{const P=_.width*I;j.push(u[Z].map(C=>{const W=F(C);return W.frame.x=v,W.frame.width=P,this.stretchDescendantsWidths(W,P)})),w.push({x:v,y:_.y,width:P,height:_.height}),v+=P}),m=w,u=j,c=v-t,p=c}const x=m.length>0?m[m.length-1].width:c/o,y=Ve(i,e,{x:t,y:n,width:p,height:s+h},s);return y.caseColumnFrames=m,y.dividerX=m.length>0?m[m.length-1].x:t+c-x,y.dividerYInset=e.type===g.fallauswahl?-20:0,y.columns=u,y.children=u.flat(),y}}function Pn(a,e){if(Math.abs(e)<=1e-4)return a;const t=F(a),n=i=>{const s=F(i);return s.frame.y+=e,Pn(s,e)};return t.columns?(t.columns=t.columns.map(i=>i.map(n)),t.children=t.columns.flat()):t.children=t.children.map(n),t}function H1(a,e){if(Math.abs(e)<=1e-4)return a;const t=F(a);return t.frame.x+=e,t.columns?(t.columns=t.columns.map(n=>n.map(i=>H1(i,e))),t.children=t.columns.flat()):t.children=t.children.map(n=>H1(n,e)),t}function $a(a,e){if(a.length<2)return{columns:a,columnHeights:a.map(m=>m.reduce((u,c)=>u+c.frame.height,0))};const t=.5,n=[e];for(const m of a)for(const u of m)n.push(u.frame.y+u.frame.height);const i=Math.max(...n);n.push(i),n.sort((m,u)=>m-u);let s=[];for(const m of n)s.length>0&&Math.abs(m-s[s.length-1])<=t||s.push(m);(s.length===0||Math.abs(s[0]-e)>t)&&s.unshift(e),s.length===0?s=[e,i]:s[s.length-1]{let c=Math.max(0,u);for(;c{let x=F(h);const y=s[c],I=h.frame.y+h.frame.height,v=p===m.length-1?s.length-1:r(I,c+1),w=s[v],j=y-x.frame.y;x.frame.y=y,x.frame.height=Math.max(0,w-y),x=Pn(x,j),u.push(x),c=v}),o.push(u),l.push(s[s.length-1]-e)}return{columns:o,columnHeights:l}}const Zt=[{item:"anweisung",label:"Anweisung"},{item:"verzweigung",label:"Verzweigung"},{item:"fallauswahl",label:"Fallauswahl"},{item:"forZaehlSchleife",label:"For-Schleife"},{item:"whileSchleife",label:"While-Schleife"},{item:"doUntilSchleife",label:"Do-while-Schleife"},{item:"endlosschleife",label:"Endlosschleife"},{item:"aufruf",label:"Aufruf"},{item:"aussprung",label:"Aussprung"}];function Re(a){const e=Te;switch(a){case"anweisung":return K(g.anweisung);case"verzweigung":return K(g.verzweigung,{cases:[{name:"true",elements:[e()]},{name:"false",elements:[e()]}]});case"fallauswahl":return K(g.fallauswahl,{cases:[{name:"1",elements:[e()]},{name:"2",elements:[e()]},{name:"default",elements:[e()]}]});case"forZaehlSchleife":return K(g.forSchleife,{textLines:["","",""],loopBody:[e()]});case"whileSchleife":return K(g.whileSchleife,{loopBody:[e()]});case"doUntilSchleife":return K(g.doUntilSchleife,{loopBody:[e()]});case"endlosschleife":return K(g.endlosschleife,{loopBody:[e()]});case"aussprung":return K(g.aussprung);case"aufruf":return K(g.aufruf)}}function i1(a){if(a==="")return"-1;";let e="";for(const t of a)e+=t.codePointAt(0)+";";return e}function N1(a){const e=a.split(";").filter(n=>n!=="");if(e.length===1&&e[0]==="-1")return"";let t="";for(const n of e){if(!/^[+-]?\d+$/.test(n))continue;const i=Number(n);i!==-1&&(i<0||i>1114111||i>=55296&&i<=57343||(t+=String.fromCodePoint(i)))}return t}class _t extends Error{}function rt(a){const e=new DOMParser().parseFromString(a,"application/xml");if(e.getElementsByTagName("parsererror").length>0)throw new _t("Could not read XML.");const t=e.documentElement;if(!t||t.tagName!=="struktogramm")throw new _t("Invalid XML: root element is not .");const n={caption:Pt(t,"caption")??"",elements:L1(t)},i=Pt(t,"fontfamily");i!==void 0&&(n.fontFamily=i);const s=je(t,"fontsize");s!==void 0&&(n.fontSize=s);const r=je(t,"fontstyle");return r!==void 0&&(n.fontStyle=r),t.getAttribute("pseudocode")==="true"&&(n.pseudocode=!0),n}function M1(a){const e=(n,i)=>i===void 0?"":` ${n}="${Cn(i)}"`;let t=` +var Za=Object.defineProperty;var _a=(a,e,t)=>e in a?Za(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var y=(a,e,t)=>_a(a,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var g=(a=>(a[a.anweisung=0]="anweisung",a[a.verzweigung=1]="verzweigung",a[a.fallauswahl=2]="fallauswahl",a[a.forSchleife=3]="forSchleife",a[a.whileSchleife=4]="whileSchleife",a[a.doUntilSchleife=5]="doUntilSchleife",a[a.endlosschleife=6]="endlosschleife",a[a.aussprung=7]="aussprung",a[a.aufruf=8]="aufruf",a[a.leerElement=9]="leerElement",a))(g||{});function ja(a){return a===3||a===4||a===5||a===6}function Pa(a){return a===1||a===2}function K(a,e={}){return{type:a,zoomX:0,zoomY:0,textLines:[""],...e}}function Ca(a){const e=a.textLines;if(!e.every(t=>t.trim()===""))switch(a.type){case g.forSchleife:return e.length<=1?e:[Ta(e)];case g.verzweigung:return Ne("if",e);case g.whileSchleife:return Ne("while",e);case g.doUntilSchleife:return Ne("while",Aa(e));case g.fallauswahl:return Ne("switch",e);default:return e}}function Aa(a){if(a.length===0)return a;const e=a[0].trim(),t=e.toLowerCase(),n=[...a];if(t==="until")n[0]="";else if(t.startsWith("until "))n[0]=e.slice(6).trim();else if(t.startsWith("until("))n[0]=e.slice(5);else return a;return n}function ft(a){const e=new Set(["if","for","while","until","switch"]),t=["input:","output:","print:"],n=a.trim(),i=n.toLowerCase();for(const o of t){if(i===o)return{keyword:n,rest:""};if(i.startsWith(o+" "))return{keyword:n.slice(0,o.length),rest:n.slice(o.length).trim()}}const s=n.indexOf(" ");if(s<0)return;const r=n.slice(0,s);if(e.has(r.toLowerCase()))return{keyword:r,rest:n.slice(s+1).trim()}}function Ne(a,e){if(e.length===0)return e;const t=e[0].trim(),n=t.toLowerCase();if(n===a||n.startsWith(a+" "))return e;const i=[...e];return i[0]=a+" "+t,i}function Ta(a){let e=[...a];for(;e.length<3;)e.push("");e=e.slice(0,3);const t=i=>{let s=i.trim();for(;s.endsWith(";");)s=s.slice(0,-1).trim();return s},n=e.map(t).join("; ").trim();return n===""?"for":"for "+n}const yn={[g.anweisung]:"Anweisung",[g.verzweigung]:"Bedingung",[g.fallauswahl]:"Fallauswahl",[g.forSchleife]:"for 0 < i < anzahl",[g.whileSchleife]:"while …",[g.doUntilSchleife]:"while …",[g.endlosschleife]:"endless",[g.aussprung]:"break",[g.aufruf]:"Aufruf()",[g.leerElement]:"ø"};function Da(a){Object.assign(yn,a)}function tt(a){return Ca(a)??[yn[a.type]]}class E extends Error{}const se=a=>structuredClone(a);function Te(){return K(g.anweisung,{textLines:["ø"]})}function Wa(){return{caption:"",elements:[Te()]}}function nt(a){if(a.type===g.leerElement)return!0;if(a.type===g.anweisung){const e=a.textLines;return e.length===0||e.length===1&&e[0]==="ø"}return!1}function ve(a,e){const t=$(a,e);return t!==void 0&&nt(t)}function Ge(a,e){if(e.length===0)throw new E("Invalid element path.");const[t,...n]=e;if(t<0||t>=a.length)throw new E("Invalid element path.");if(n.length===0)return{list:a,index:t};const[i,...s]=n;if(s.length===0)throw new E("Invalid element path.");return Ge(zn(a[t],i),s)}function zn(a,e){if(ja(a.type)){if(e!==0||!a.loopBody)throw new E("Invalid element path.");return a.loopBody}if(Pa(a.type)){if(!a.cases||e<0||e>=a.cases.length)throw new E("Invalid element path.");return a.cases[e].elements}throw new E("Invalid element path.")}function ne(a,e){const{list:t,index:n}=Ge(a.elements,e);return t[n]}function $(a,e){try{return ne(a,e)}catch{return}}function ge(a,e,t){const n=se(a),{list:i,index:s}=Ge(n.elements,e);return i[s]=se(t),n}function w1(a,e,t){const n=se(ne(a,e));return n.textLines=t.length===0?[""]:t,ge(a,e,n)}function S1(a,e){return e.length===0?!1:e.length===1&&a.elements.length===1?!ve(a,e):$(a,e)!==void 0}function De(a,e){const t=se(a),{list:n,index:i}=Ge(t.elements,e);if(e.length===1&&n.length===1){if(nt(n[0]))throw new E("The last root element cannot be deleted.");return n[0]=Te(),t}return n.splice(i,1),e.length>1&&n.length===0&&n.push(Te()),t}function _e(a,e,t,n){const i=se(a);let s;if(e.length===0)s=i.elements;else{const r=e.slice(0,-1),o=e[e.length-1],{list:l,index:m}=Ge(i.elements,r);s=zn(l[m],o)}return s.splice(Math.min(Math.max(0,t),s.length),0,se(n)),i}function vn(a,e,t){if(t.length===0)throw new E("Invalid element path.");return _e(a,t.slice(0,-1),t[t.length-1],e)}function G1(a,e,t){if(t.length===0)throw new E("Invalid element path.");return _e(a,t.slice(0,-1),t[t.length-1]+1,e)}function at(a,e){return a.lengthe[n]===t)}function it(a,e){if(e.length===0)return a;const t=e[e.length-1],n=e.slice(0,-1);if(a.length<=n.length||!n.every((r,o)=>a[o]===r))return a;const i=n.length;if(a[i]<=t)return a;const s=[...a];return s[i]-=1,s}const st=(a,e)=>a.length===e.length&&a.every((t,n)=>t===e[n]);function Ba(a,e,t){if(st(e,t))return a;if(at(e,t))throw new E("Invalid element path.");const n=ne(a,e),i=De(a,e);return vn(i,n,it(t,e))}function Ga(a,e,t){if(st(e,t))return a;if(at(e,t))throw new E("Invalid element path.");const n=ne(a,e),i=De(a,e);return G1(i,n,it(t,e))}function Ha(a,e,t){if(!ve(a,t))throw new E("Invalid element path.");if(st(e,t))return a;if(at(e,t))throw new E("Invalid element path.");const n=ne(a,e),i=De(a,e);return ge(i,it(t,e),n)}function Na(a,e){const t=se(ne(a,e)),n=t.cases;if(t.type!==g.fallauswahl||!n||n.length===0)throw new E("Invalid element path.");const i=n[n.length-1].name.toLowerCase()==="default",s=i?n.length-1:n.length,r=String(i?n.length:n.length+1);return n.splice(s,0,{name:r,elements:[Te()]}),{doc:ge(a,e,t),path:[...e,s,0]}}function Ea(a,e,t){const n=se(ne(a,e)),i=n.cases;if(n.type!==g.fallauswahl||!i)throw new E("Invalid element path.");if(i.length<=2)throw new E("A switch needs at least two cases.");if(t<0||t>=i.length)throw new E("Invalid element path.");i.splice(t,1);const s=Math.min(t,i.length-1);return{doc:ge(a,e,n),path:[...e,s,0]}}function La(a,e,t,n){const i=se(ne(a,e)),s=i.cases;if(i.type!==g.fallauswahl||!s)throw new E("Invalid element path.");if(t<0||t>=s.length)throw new E("Invalid element path.");const r=n.trim();if(r==="")throw new E("Invalid element path.");return s[t].name=r,ge(a,e,i)}function Va(a,e){var t;if(!(!a||a.length===0))for(let n=a.length;n>=1;n--){const i=a.slice(0,n);if(((t=$(e,i))==null?void 0:t.type)===g.fallauswahl)return i}}function Ra(a,e){if(!(!a||a.length<=e.length))return a[e.length]}function yt(a,e){if(e.elements.length!==0)return!a||!$(e,a)?[0]:a}const wn=a=>a!==void 0&&/\s/.test(a);function a1(a){const e=a.trim().toLowerCase();return e.startsWith("input:")?"input":e.startsWith("output:")||e.startsWith("print:")?"output":"statement"}function Ua(a){const e=a.trim(),t=e.toLowerCase();return t.startsWith("input:")?e.slice(6).trim():t.startsWith("output:")?e.slice(7).trim():t.startsWith("print:")?e.slice(6).trim():a}function zt(a,e){const t=e.trim();return t===""?`${a} `:`${a} ${t}`}function Fa(a,e){const t=Ua(e);switch(a){case"statement":return t;case"input":return zt("input:",t);case"output":return zt("output:",t)}}const qe=a=>wn(a[0])?a.slice(1):a;function Ya(a){const e=a.replace(/^\s+/,""),t=e.toLowerCase();return t.startsWith("input:")?qe(e.slice(6)):t.startsWith("output:")?qe(e.slice(7)):t.startsWith("print:")?qe(e.slice(6)):a}function vt(a,e){const t=e.replace(/^\s+/,"");if(!t.toLowerCase().startsWith(a.toLowerCase()))return e;const n=t.slice(a.length);if(!(n===""||wn(n[0])||n[0]==="("))return e;const i=qe(n);return i.startsWith("(")&&i.endsWith(")")&&i.length>=2?i.slice(1,-1):i}function wt(a,e){if(a==="input:"||a==="output:")return Ya(e);const t=vt(a,e);if(a==="while"&&t===e){const n=vt("until",e);if(n!==e)return n}return t}function Oa(a,e){return e===""?`${a} `:`${a} ${e}`}function Sn(a){return a.replace(/[“”„«»]/g,'"').replace(/[’‘‚´]/g,"'")}function St(a){const e=a.length===0?[""]:a.slice(0,3);for(;e.length<3;)e.push("");return e}function Qa(a){let e=Sn(a);for(;;){const t=e.trim();if(!t.endsWith(";"))return e;e=t.slice(0,-1).trim()}}const p1='system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';function Xa(a,e){return`${e==="bold"?700:500} ${a}px ${p1}`}const kn=(a,e,t)=>[...a].length*e*(t==="bold"?.68:.62);function Ja(){if(typeof document>"u"||!document.body)return;const a="http://www.w3.org/2000/svg",e=document.createElementNS(a,"svg");e.setAttribute("aria-hidden","true"),e.setAttribute("width","0"),e.setAttribute("height","0"),e.style.cssText="position:absolute;left:-9999px;top:0;visibility:hidden;overflow:hidden";const t=document.createElementNS(a,"text");if(t.setAttribute("font-family",p1),t.style.whiteSpace="pre",e.append(t),document.body.append(e),typeof t.getComputedTextLength!="function"||typeof t.getBBox!="function"){e.remove();return}if(t.textContent="Mg",t.setAttribute("font-size","20"),!(t.getComputedTextLength()>0)){e.remove();return}return t}let k1;function Mn(){return k1===void 0&&(k1=Ja()??null),k1??void 0}function Zn(a,e,t){a.setAttribute("font-size",String(e)),a.setAttribute("font-weight",t==="bold"?"700":"500")}function kt(a,e){const t=`${a}|${e}`;let n=Mt.get(t);if(!n){const i=Mn();if(n={ascent:a*.95,descent:a*.24},i){Zn(i,a,e),i.setAttribute("y","0"),i.textContent="Mg";const s=i.getBBox();s.height>0&&(n={ascent:-s.y,descent:s.height+s.y})}Mt.set(t,n)}return n}const Mt=new Map;function qa(){const a=Mn();if(a){const n=new Map;return(i,s,r)=>{const o=`${s}|${r}|${i}`;let l=n.get(o);return l===void 0&&(Zn(a,s,r),a.textContent=i,l=i===""?0:a.getComputedTextLength(),n.size>2e3&&n.clear(),n.set(o,l)),l}}const e=typeof document<"u"?document.createElement("canvas").getContext("2d"):null;if(!e)return kn;const t=new Map;return(n,i,s)=>{const r=`${i}|${s}|${n}`;let o=t.get(r);return o===void 0&&(e.font=Xa(i,s),o=e.measureText(n).width,t.size>2e3&&t.clear(),t.set(r,o)),o}}const _n={fontSize:15,lineHeight:20,charWidth:7,baseHeaderExtra:20,minSidePadding:42,cellTextInsetY:15,doUntilDoLabelTopInset:2,doUntilFooterTopInset:6,doUntilFooterBottomInset:8};function Ka(a){return{..._n,fontSize:14,lineHeight:21,charWidth:5.5*(14/12),baseHeaderExtra:21,minSidePadding:40}}const Ee=a=>a===g.forSchleife||a===g.whileSchleife||a===g.doUntilSchleife||a===g.endlosschleife,Le=a=>a===g.fallauswahl||a===g.verzweigung;function Ve(a,e,t,n=0){return{idPath:a,element:e,frame:t,headerBandHeight:n,topBandHeight:0,loopBodyLeadingInset:0,caseColumnFrames:[],children:[]}}function F(a){return{...a,frame:{...a.frame}}}class jn{constructor(e=_n,t=kn){this.metrics=e,this.measure=t}layout(e,t={left:28,top:28}){const i=this.layoutList(e.elements,t.left,t.top,[]).map(l=>this.stretchLoopBodiesVertically(l));let s=0,r=0;const o=l=>{s=Math.max(s,l.frame.x+l.frame.width),r=Math.max(r,l.frame.y+l.frame.height),l.children.forEach(o)};return i.forEach(o),{canvasSize:{width:s+t.left,height:r+t.top},elements:i}}lineWidth(e){return Math.ceil(this.measure(e,this.metrics.fontSize,"medium"))}lineWidthBold(e){return Math.ceil(this.measure(e,this.metrics.fontSize,"bold"))}layoutList(e,t,n,i){let s=[],r=n;e.forEach((l,m)=>{const u=this.layoutElement(l,t,r,[...i,m]);s.push(u),r+=u.frame.height});const o=Math.max(0,...s.map(l=>l.frame.width));return o>0&&(s=s.map(l=>this.stretchNodeTreeToWidth(l,o))),s}stretchMultiwayNodeToWidth(e,t){const n=F(e),i=n.frame.width;if(!(i>0)||n.caseColumnFrames.length===0)return n;const s=t/i;n.frame.width=t;let r=n.frame.x;const o=n.caseColumnFrames.map(l=>{const m=l.width*s,u={x:r,y:l.y,width:m,height:l.height};return r+=m,u});return n.caseColumnFrames=o,n.dividerX=o.length>0?o[o.length-1].x:n.frame.x+t,n.columns&&n.columns.length===o.length&&(n.columns=n.columns.map((l,m)=>{const u=o[m];return l.map(c=>{const h=F(c);return h.frame.x=u.x,h.frame.width=u.width,this.stretchDescendantsWidths(h,u.width)})}),n.children=n.columns.flat()),n}stretchLoopChildren(e,t){const n=this.effectiveLoopBodyLeading(e),i=Math.max(0,t-n);e.children=e.children.map(s=>{const r=F(s);return r.frame.x=e.frame.x+n,r.frame.width=i,this.stretchDescendantsWidths(r,i)})}stretchNodeTreeToWidth(e,t){const n=F(e);return n.frame.width>0?Le(n.element.type)&&n.caseColumnFrames.length>0?this.stretchMultiwayNodeToWidth(n,t):(n.frame.width=t,Ee(n.element.type)?this.stretchLoopChildren(n,t):n.children=n.children.map(s=>this.stretchDescendantsWidths(s,t)),n):n}stretchDescendantsWidths(e,t){let n=F(e);return Le(n.element.type)?n=this.stretchNodeTreeToWidth(n,t):Ee(n.element.type)?(n.frame.width=t,this.stretchLoopChildren(n,t)):(n.frame.width=t,n.children=n.children.map(i=>this.stretchDescendantsWidths(i,t))),n}stretchLoopBodiesVertically(e){const t=F(e);if(t.columns&&t.columns.length>0)return t.columns=t.columns.map(s=>s.map(r=>this.stretchLoopBodiesVertically(r))),t.children=t.columns.flat(),t;t.children=t.children.map(s=>this.stretchLoopBodiesVertically(s));const n=s=>s===g.anweisung||s===g.leerElement||s===g.aufruf||s===g.aussprung||Ee(s);let i;switch(t.element.type){case g.forSchleife:case g.whileSchleife:case g.endlosschleife:{const s=t.element.type===g.endlosschleife?40:0;i=t.frame.y+t.frame.height-s;break}case g.doUntilSchleife:i=t.frame.y+t.frame.height-t.headerBandHeight;break}if(i!==void 0&&t.children.length>0){const s=t.children.length-1;let r=F(t.children[s]);const o=i-(r.frame.y+r.frame.height);o>.5&&n(r.element.type)&&(r.frame.height+=o,r=this.stretchLoopBodiesVertically(r),t.children=[...t.children.slice(0,s),r])}return t}headerHeight(e){const t=this.metrics,n=Math.max(1,e.textLines.length);if(e.type===g.doUntilSchleife)return t.doUntilFooterTopInset+n*t.lineHeight+t.doUntilFooterBottomInset+e.zoomY;let i;switch(e.type){case g.fallauswahl:i=40;break;case g.verzweigung:i=20;break;case g.forSchleife:case g.whileSchleife:case g.endlosschleife:i=t.baseHeaderExtra+4;break;default:i=14}return i+n*t.lineHeight+e.zoomY}doUntilBodyLeadingInset(){return Math.max(20,this.lineWidthBold("do")+12)}effectiveLoopBodyLeading(e){return e.element.type===g.doUntilSchleife?e.loopBodyLeadingInset>0?e.loopBodyLeadingInset:this.doUntilBodyLeadingInset():20}horizontalPaddingInsideCell(e){return Le(e)?Math.max(100,this.metrics.minSidePadding*2.45):this.metrics.minSidePadding}minWidth(e){const t=e.textLines.length===0?0:Math.max(...e.textLines.map(s=>this.lineWidth(s)));let n=t+e.zoomX+this.horizontalPaddingInsideCell(e.type);if(e.type===g.aufruf){const s=Math.max(68,this.metrics.minSidePadding*1.7),r=Math.max(8,this.metrics.minSidePadding*.2);n=Math.max(n,t+e.zoomX+s+r)}const i=e.type===g.leerElement?76:e.type===g.aufruf?104:72;return Math.max(i,n)}layoutElement(e,t,n,i){if(Le(e.type))return this.layoutMultiway(e,t,n,i);if(Ee(e.type))return this.layoutLoop(e,t,n,i);const s=this.headerHeight(e);return Ve(i,e,{x:t,y:n,width:this.minWidth(e),height:s},s)}layoutLoop(e,t,n,i){const s=I=>I.reduce((v,w)=>v+w.frame.height,0),r=I=>Math.max(0,...I.map(v=>v.frame.width)),o=e.loopBody??[];if(e.type===g.doUntilSchleife){const I=this.doUntilBodyLeadingInset(),v=e.zoomY,w=this.headerHeight(e),j=this.layoutList(o,t+I,n+v,[...i,0]),_=Math.max(this.minWidth(e),r(j)+I),Z=s(j)+w+v,P=Math.max(0,_-I),C=Ve(i,e,{x:t,y:n,width:_,height:Z},w);return C.topBandHeight=v,C.loopBodyLeadingInset=I,C.children=j.map(W=>{const B=F(W);return B.frame.x=t+I,B.frame.width=P,this.stretchDescendantsWidths(B,P)}),C}const l=20,m=this.headerHeight(e),u=e.type===g.endlosschleife?40:0,c=this.layoutList(o,t+l,n+m,[...i,0]),h=Math.max(this.minWidth(e),r(c)+l),p=m+u+s(c),x=Math.max(0,h-l),f=Ve(i,e,{x:t,y:n,width:h,height:p},m);return f.children=c.map(I=>{const v=F(I);return v.frame.x=t+l,v.frame.width=x,this.stretchDescendantsWidths(v,x)}),f}layoutMultiway(e,t,n,i){const s=this.headerHeight(e),r=e.cases??[],o=Math.max(1,r.length),l=Math.max(this.minWidth(e)/o,132);let m=[],u=[],c=0,h=0;if(r.forEach((I,v)=>{const w=t+c,j=this.layoutList(I.elements,w,n+s,[...i,v]),_=Math.max(0,...j.map(C=>C.frame.width));let Z;e.type===g.verzweigung&&o===2?Z=Math.max(_,(v===0?"true":"false").length*this.metrics.charWidth+24):Z=Math.max(l,_);const P=j.reduce((C,W)=>C+W.frame.height,0);h=Math.max(h,P),m.push({x:w,y:n+s,width:Z,height:P}),u.push(j.map(C=>{const W=F(C);return W.frame.x=w,W.frame.width=Z,this.stretchDescendantsWidths(W,Z)})),c+=Z}),e.type===g.verzweigung&&o===2&&m.length===2){const I=Math.max(m[0].width,m[1].width),v=t,w=t+I,j=w-m[1].x;m[0]={...m[0],x:v,width:I},m[1]={...m[1],x:w,width:I},c=I*2,u[0]=u[0].map(_=>{const Z=F(_);return Z.frame.x=v,Z.frame.width=I,this.stretchDescendantsWidths(Z,I)}),u[1]=u[1].map(_=>{const Z=H1(_,j);return Z.frame.width=I,this.stretchDescendantsWidths(Z,I)})}if(u.length>0){const I=$a(u,n+s);u=I.columns.map(v=>v.map(w=>this.stretchLoopBodiesVertically(w)));for(let v=0;v0?Math.max(...I.columnHeights):h}let p=Math.max(c,this.minWidth(e));if(c>.5&&p>c+.5){const I=p/c;let v=t;const w=[],j=[];m.forEach((_,Z)=>{const P=_.width*I;j.push(u[Z].map(C=>{const W=F(C);return W.frame.x=v,W.frame.width=P,this.stretchDescendantsWidths(W,P)})),w.push({x:v,y:_.y,width:P,height:_.height}),v+=P}),m=w,u=j,c=v-t,p=c}const x=m.length>0?m[m.length-1].width:c/o,f=Ve(i,e,{x:t,y:n,width:p,height:s+h},s);return f.caseColumnFrames=m,f.dividerX=m.length>0?m[m.length-1].x:t+c-x,f.dividerYInset=e.type===g.fallauswahl?-20:0,f.columns=u,f.children=u.flat(),f}}function Pn(a,e){if(Math.abs(e)<=1e-4)return a;const t=F(a),n=i=>{const s=F(i);return s.frame.y+=e,Pn(s,e)};return t.columns?(t.columns=t.columns.map(i=>i.map(n)),t.children=t.columns.flat()):t.children=t.children.map(n),t}function H1(a,e){if(Math.abs(e)<=1e-4)return a;const t=F(a);return t.frame.x+=e,t.columns?(t.columns=t.columns.map(n=>n.map(i=>H1(i,e))),t.children=t.columns.flat()):t.children=t.children.map(n=>H1(n,e)),t}function $a(a,e){if(a.length<2)return{columns:a,columnHeights:a.map(m=>m.reduce((u,c)=>u+c.frame.height,0))};const t=.5,n=[e];for(const m of a)for(const u of m)n.push(u.frame.y+u.frame.height);const i=Math.max(...n);n.push(i),n.sort((m,u)=>m-u);let s=[];for(const m of n)s.length>0&&Math.abs(m-s[s.length-1])<=t||s.push(m);(s.length===0||Math.abs(s[0]-e)>t)&&s.unshift(e),s.length===0?s=[e,i]:s[s.length-1]{let c=Math.max(0,u);for(;c{let x=F(h);const f=s[c],I=h.frame.y+h.frame.height,v=p===m.length-1?s.length-1:r(I,c+1),w=s[v],j=f-x.frame.y;x.frame.y=f,x.frame.height=Math.max(0,w-f),x=Pn(x,j),u.push(x),c=v}),o.push(u),l.push(s[s.length-1]-e)}return{columns:o,columnHeights:l}}const Zt=[{item:"anweisung",label:"Anweisung"},{item:"verzweigung",label:"Verzweigung"},{item:"fallauswahl",label:"Fallauswahl"},{item:"forZaehlSchleife",label:"For-Schleife"},{item:"whileSchleife",label:"While-Schleife"},{item:"doUntilSchleife",label:"Do-while-Schleife"},{item:"endlosschleife",label:"Endlosschleife"},{item:"aufruf",label:"Aufruf"},{item:"aussprung",label:"Aussprung"}];function Re(a){const e=Te;switch(a){case"anweisung":return K(g.anweisung);case"verzweigung":return K(g.verzweigung,{cases:[{name:"true",elements:[e()]},{name:"false",elements:[e()]}]});case"fallauswahl":return K(g.fallauswahl,{cases:[{name:"1",elements:[e()]},{name:"2",elements:[e()]},{name:"default",elements:[e()]}]});case"forZaehlSchleife":return K(g.forSchleife,{textLines:["","",""],loopBody:[e()]});case"whileSchleife":return K(g.whileSchleife,{loopBody:[e()]});case"doUntilSchleife":return K(g.doUntilSchleife,{loopBody:[e()]});case"endlosschleife":return K(g.endlosschleife,{loopBody:[e()]});case"aussprung":return K(g.aussprung);case"aufruf":return K(g.aufruf)}}function i1(a){if(a==="")return"-1;";let e="";for(const t of a)e+=t.codePointAt(0)+";";return e}function N1(a){const e=a.split(";").filter(n=>n!=="");if(e.length===1&&e[0]==="-1")return"";let t="";for(const n of e){if(!/^[+-]?\d+$/.test(n))continue;const i=Number(n);i!==-1&&(i<0||i>1114111||i>=55296&&i<=57343||(t+=String.fromCodePoint(i)))}return t}class _t extends Error{}function rt(a){const e=new DOMParser().parseFromString(a,"application/xml");if(e.getElementsByTagName("parsererror").length>0)throw new _t("Could not read XML.");const t=e.documentElement;if(!t||t.tagName!=="struktogramm")throw new _t("Invalid XML: root element is not .");const n={caption:Pt(t,"caption")??"",elements:L1(t)},i=Pt(t,"fontfamily");i!==void 0&&(n.fontFamily=i);const s=je(t,"fontsize");s!==void 0&&(n.fontSize=s);const r=je(t,"fontstyle");return r!==void 0&&(n.fontStyle=r),t.getAttribute("pseudocode")==="true"&&(n.pseudocode=!0),n}function M1(a){const e=(n,i)=>i===void 0?"":` ${n}="${Cn(i)}"`;let t=` `;t+=" `;for(const n of a.elements)t+=E1(n," ");return t+=` `,t}function E1(a,e){let t=`${e} @@ -8,9 +8,9 @@ var Za=Object.defineProperty;var _a=(a,e,t)=>e in a?Za(a,e,{enumerable:!0,config `}if(a.cases)for(const n of a.cases){t+=`${e} `;for(const i of n.elements)t+=E1(i,e+" ");t+=`${e} `}return t+=`${e} -`,t}function Cn(a){return a.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}function ei(a){return a.replace(/&/g,"&").replace(//g,">")}function jt(a){return String(a.a<<24|a.r<<16|a.g<<8|a.b|0)}function Ke(a,e){return Array.from(a.children).filter(t=>t.tagName===e)}function L1(a){const e=[];for(const t of Ke(a,"strelem")){const n=ti(t);n&&e.push(n)}return e}function ti(a){const e=je(a,"typ");if(e===void 0||g[e]===void 0)return;const t={type:e,zoomX:je(a,"zx")??0,zoomY:je(a,"zy")??0,textLines:Ke(a,"text").map(o=>N1((o.textContent??"").trim()))},n=Ct(a.getAttribute("textcolor"));n&&(t.textColor=n);const i=Ct(a.getAttribute("bgcolor"));i&&(t.backgroundColor=i),t.textLines.length===0&&(t.textLines=[""]);const s=Ke(a,"schleifeninhalt")[0];if(s){const o=L1(s);o.length>0&&(t.loopBody=o)}const r=Ke(a,"fall").map(o=>({name:N1(o.getAttribute("fallname")??""),elements:L1(o)}));return r.length>0&&(t.cases=r),t}function Pt(a,e){const t=a.getAttribute(e);return t===null?void 0:N1(t)}function je(a,e){const t=a.getAttribute(e);if(!(t===null||!/^[+-]?\d+$/.test(t)))return Number(t)}function Ct(a){if(a===null||!/^[+-]?\d+$/.test(a))return;const e=Number(a);if(e<-2147483648||e>2147483647)return;const t=e>>>0;return{a:t>>>24&255,r:t>>>16&255,g:t>>>8&255,b:t&255}}const ni="http://www.w3.org/2000/svg",L={diagramLineWidth:2,outerFrameLineWidth:2,selectionLineWidth:3.5,canvasOuterMargin:16,cellTextInsetX:18,cellTextInsetY:15,multiHeaderFirstLineY:14,branchLabelInsetX:10,fallauswahlCaseLabelBand:26,callSideBarInset:14,callTextInsetFromSideBar:20,loopBodyLeadingInset:20};function D(a,e={}){const t=document.createElementNS(ni,a);for(const[n,i]of Object.entries(e))t.setAttribute(n,String(i));return t}class An{constructor(e,t){b(this,"usesSimulationHighlight",!1);this.metrics=e,this.measure=t}get lineHeight(){return this.metrics.lineHeight}get fontSize(){return this.metrics.fontSize}render(e,t,n,i=L.canvasOuterMargin){const s=D("svg",{width:t.width,height:t.height,viewBox:`0 0 ${t.width} ${t.height}`,"font-family":p1,"font-size":this.fontSize,class:"diagram"});s.append(D("rect",{x:0,y:0,width:t.width,height:t.height,fill:"#fafafa"}));const r=i;s.append(D("rect",{x:r,y:r,width:e.canvasSize.width-2*r-1,height:e.canvasSize.height-2*r-1,fill:"none",stroke:"black","stroke-width":L.outerFrameLineWidth}));const o=D("g");for(const l of e.elements)this.drawNode(l,o,n,{},void 0);return s.append(o),s}line(e,t){e.append(D("polyline",{points:t.map(n=>n.join(",")).join(" "),fill:"none",stroke:"black","stroke-width":L.diagramLineWidth,"stroke-linejoin":"miter"}))}strokeCellBorder(e,t,n){const i=t.x,s=t.y,r=t.x+t.width,o=t.y+t.height;if(!n.top&&!n.left&&!n.bottom&&!n.right){e.append(D("rect",{x:i,y:s,width:t.width,height:t.height,fill:"none",stroke:"black","stroke-width":L.diagramLineWidth}));return}n.top||this.line(e,[[i,s],[r,s]]),n.right||this.line(e,[[r,s],[r,o]]),n.bottom||this.line(e,[[r,o],[i,o]]),n.left||this.line(e,[[i,o],[i,s]])}textWidth(e){const t=ft(e);return t?this.measure(t.keyword,this.fontSize,"bold")+(t.rest===""?0:this.measure(" "+t.rest,this.fontSize,"medium")):this.measure(e,this.fontSize,"medium")}drawKeywordLine(e,t,n,i){const s=D("text",{x:n,y:i+kt(this.fontSize,"medium").ascent,"font-weight":500});s.style.whiteSpace="pre";const r=ft(t);if(r){const o=D("tspan",{"font-weight":700});if(o.textContent=r.keyword,s.append(o),r.rest!==""){const l=D("tspan",{});l.textContent=" "+r.rest,s.append(l)}}else s.textContent=t;e.append(s)}drawLabel(e,t,n,i,s,r){const o=kt(this.fontSize,s?"bold":"medium"),l=D("text",{x:n,y:r==="top"?i+o.ascent:i-o.descent,"font-weight":s?700:500});l.style.whiteSpace="pre",l.textContent=t,e.append(l)}roofMetrics(e,t,n,i){const s=t.y+n,r=e.dividerYInset??0,o=12,l=Math.max(e.element.textLines.length,1)*this.lineHeight,m=t.y+L.multiHeaderFirstLineY;if(e.element.type===g.fallauswahl){const c=Math.max(L.fallauswahlCaseLabelBand,this.lineHeight+10),h=s-c,p=Math.min(s+r,h-8),x=Math.max(p,m+l+6);return{apex:{x:i,y:x},maxTextBottom:h-o,roofBottom:s}}const u={x:i,y:s+r};return{apex:u,maxTextBottom:u.y-o,roofBottom:s}}drawNode(e,t,n,i,s){var j;const r=e.frame,o=e.element,l=r.x+r.width,m=r.y+r.height,u=o.type===g.verzweigung||o.type===g.fallauswahl,c=u?e.headerBandHeight:0,h=n!==void 0&&V1(e.idPath,n),p=tt(o),x=D("g",{"data-path":e.idPath.join(",")});t.append(x);const y=this.usesSimulationHighlight,I=h&&y?"rgba(199, 230, 255, 0.55)":"white";x.append(D("rect",{x:r.x,y:r.y,width:r.width,height:r.height,fill:I})),this.strokeCellBorder(x,r,i);const v=L.callSideBarInset;if(o.type===g.aufruf?(this.line(x,[[r.x+v,r.y],[r.x+v,m]]),this.line(x,[[l-v,r.y],[l-v,m]])):o.type===g.aussprung&&this.line(x,[[r.x+v,r.y],[r.x,r.y+r.height/2],[r.x+v,m]]),u&&e.dividerX!==void 0){const _=e.dividerX,Z=this.roofMetrics(e,r,c,_),P=Math.max(p.length,1)*this.lineHeight,C=r.y+L.multiHeaderFirstLineY;this.line(x,[[r.x,r.y],[Z.apex.x,Z.apex.y],[l,r.y]]),o.type===g.fallauswahl&&this.line(x,[[r.x,Z.roofBottom],[l,Z.roofBottom]]);let W;C+P<=Z.maxTextBottom?W=C:W=Math.max(r.y+2,Z.maxTextBottom-(Math.max(p.length,1)-1)*this.lineHeight-this.lineHeight),p.forEach((B,oe)=>{const le=this.textWidth(B);let be;if(o.type===g.verzweigung){const v1=r.x+L.cellTextInsetX,Ma=l-le-L.cellTextInsetX;be=Math.min(Math.max(_-le/2,v1),Ma)}else be=r.x+r.width/2-le/2;this.drawKeywordLine(x,B,be,W+oe*this.lineHeight)})}else if(o.type!==g.doUntilSchleife)if(o.type===g.anweisung||o.type===g.aufruf||o.type===g.aussprung){const _=L.cellTextInsetX;let Z=r.x+_,P=l-_;o.type===g.aufruf?(Z=r.x+v+L.callTextInsetFromSideBar,P=l-v-L.callTextInsetFromSideBar):o.type===g.aussprung&&(Z=r.x+v+_);const C=Math.max(0,P-Z);let W=r.y+r.height/2-Math.max(1,p.length)*this.lineHeight/2;for(const B of p)this.drawKeywordLine(x,B,Z+(C-this.textWidth(B))/2,W),W+=this.lineHeight}else{const _=Math.max(1,p.length)*this.lineHeight;let Z=s===g.doUntilSchleife?r.y+r.height/2-_/2:r.y+L.cellTextInsetY;for(const P of p)this.drawKeywordLine(x,P,r.x+L.cellTextInsetX,Z),Z+=this.lineHeight}e.children.forEach((_,Z)=>{const P=o.type===g.doUntilSchleife&&Z===0?{top:!0,left:!0}:{};this.drawNode(_,t,n,P,o.type)});const w=D("g");if(t.append(w),o.type===g.doUntilSchleife){const _=((j=e.children[0])==null?void 0:j.frame.x)??r.x+(e.loopBodyLeadingInset>0?e.loopBodyLeadingInset:L.loopBodyLeadingInset);this.drawLabel(w,"do",r.x+4,r.y+this.metrics.doUntilDoLabelTopInset,!0,"top");const Z=m-e.headerBandHeight;this.line(w,[[_,Z],[l,Z]]),this.line(w,[[_,r.y],[_,Z]]);let P=Z+this.metrics.doUntilFooterTopInset;for(const C of p)this.drawKeywordLine(w,C,r.x+L.cellTextInsetX,P),P+=this.lineHeight}if(u&&e.dividerX!==void 0&&e.caseColumnFrames.length>1){const _=this.roofMetrics(e,r,c,e.dividerX),Z=_.apex;e.caseColumnFrames.forEach((C,W)=>{if(W>=e.caseColumnFrames.length-1)return;const B=C.x+C.width,oe=ai(B,r,Z),le=Number.isFinite(oe)?Math.min(Math.max(oe,r.y),m):r.y;this.line(w,[[B,m],[B,le]])});const P=o.cases;if(P&&P.length===e.caseColumnFrames.length){const C=o.type===g.fallauswahl?_.roofBottom-6:r.y+c-8,W=L.branchLabelInsetX;if(o.type===g.verzweigung&&P.length===2){this.drawLabel(w,"true",r.x+W,C,!0,"bottom");const B=e.caseColumnFrames[1],oe=this.measure("false",this.fontSize,"bold");this.drawLabel(w,"false",B.x+B.width-W-oe,C,!0,"bottom")}else P.forEach((B,oe)=>{const le=e.caseColumnFrames[oe],be=["default","true","false"].includes(B.name.toLowerCase()),v1=this.measure(B.name,this.fontSize,be?"bold":"medium");this.drawLabel(w,B.name,le.x+le.width/2-v1/2,C,be,"bottom")})}}h&&w.append(D("rect",{x:r.x,y:r.y,width:r.width,height:r.height,fill:"none",stroke:y?"rgba(66, 140, 242, 0.78)":"rgba(0, 122, 255, 0.9)","stroke-width":L.selectionLineWidth}))}}function ai(a,e,t){const n=e.y;if(a<=t.x){const s=t.x-e.x;return Math.abs(s)<.5?t.y:n+(t.y-n)/s*(a-e.x)}const i=e.x+e.width-t.x;return Math.abs(i)<.5?t.y:t.y+(n-t.y)/i*(a-t.x)}function V1(a,e){return a.length===e.length&&a.every((t,n)=>t===e[n])}function ii(a){const e=[],t=n=>{e.push(n),n.children.forEach(t)};return a.forEach(t),e}function s1(a){var e,t;return{...a,textLines:tt(a),loopBody:(e=a.loopBody)==null?void 0:e.map(s1),cases:(t=a.cases)==null?void 0:t.map(n=>({name:n.name,elements:n.elements.map(s1)}))}}const si="modulepreload",ri=function(a,e){return new URL(a,e).href},At={},M=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){let r=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),m=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=r(t.map(u=>{if(u=ri(u,n),u in At)return;At[u]=!0;const c=u.endsWith(".css"),h=c?'[rel="stylesheet"]':"";if(!!n)for(let y=o.length-1;y>=0;y--){const I=o[y];if(I.href===u&&(!c||I.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${h}`))return;const x=document.createElement("link");if(x.rel=c?"stylesheet":si,c||(x.as="script"),x.crossOrigin="",x.href=u,m&&x.setAttribute("nonce",m),document.head.appendChild(x),c)return new Promise((y,I)=>{x.addEventListener("load",y),x.addEventListener("error",()=>I(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(r){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=r,window.dispatchEvent(o),!o.defaultPrevented)throw r}return i.then(r=>{for(const o of r||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})},oi=[{code:"de",name:"Deutsch"},{code:"en",name:"English"},{code:"es",name:"Español"},{code:"fr",name:"Français"},{code:"it",name:"Italiano"},{code:"pl",name:"Polski"},{code:"tr",name:"Türkçe"},{code:"ko",name:"한국어"},{code:"ja",name:"日本語"},{code:"el",name:"Ελληνικά"},{code:"uk",name:"Українська"},{code:"ar",name:"العربية"},{code:"ru",name:"Русский"},{code:"he",name:"עברית"},{code:"nl",name:"Nederlands"},{code:"sv",name:"Svenska"},{code:"da",name:"Dansk"},{code:"nb",name:"Norsk bokmål"},{code:"zh-Hans",name:"中文(简体)"},{code:"zh-Hant",name:"中文(繁體)"},{code:"pt-PT",name:"Português"},{code:"java",name:"Java (Keywords)"}],Tn=["de","en","pt-PT","java"],Dn=oi.filter(a=>Tn.includes(a.code)),Tt=a=>Tn.includes(a),li=Object.assign({"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/ar.lproj/Localizable.strings":()=>M(()=>import("./Localizable-CxCno28C.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/da.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BAutdlBb.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/de.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DZlyYK1P.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/el.lproj/Localizable.strings":()=>M(()=>import("./Localizable-rqA-20hM.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/en.lproj/Localizable.strings":()=>M(()=>import("./Localizable-Dj42XC1o.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/es.lproj/Localizable.strings":()=>M(()=>import("./Localizable-LSTVB2Q5.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/fr.lproj/Localizable.strings":()=>M(()=>import("./Localizable-ByPZS4RL.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/he.lproj/Localizable.strings":()=>M(()=>import("./Localizable-R-16GCrk.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/it.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DXAPah1g.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/ja.lproj/Localizable.strings":()=>M(()=>import("./Localizable-CkJEmEEP.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/java.lproj/Localizable.strings":()=>M(()=>import("./Localizable-a8HTzUdm.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/ko.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BudCXCER.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/nb.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DSvkBkp-.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/nl.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BJ55WGVD.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/pl.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BYJK0mdR.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/pt-PT.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DvUiKfBy.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/ru.lproj/Localizable.strings":()=>M(()=>import("./Localizable-1QZ0wfvJ.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/sv.lproj/Localizable.strings":()=>M(()=>import("./Localizable-M33nNbEe.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/tr.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BM86Igqt.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/uk.lproj/Localizable.strings":()=>M(()=>import("./Localizable-UGog_aku.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/zh-Hans.lproj/Localizable.strings":()=>M(()=>import("./Localizable-CaVEL1es.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/zh-Hant.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DqIDp_hh.js"),[],import.meta.url).then(a=>a.default)}),mi=Object.assign({"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/Java.strings":()=>M(()=>import("./Java-C92fuLac.js"),[],import.meta.url).then(a=>a.default)}),ui=Object.assign({"../i18n/ar.strings":()=>M(()=>import("./ar-CvVmBZfx.js"),[],import.meta.url).then(a=>a.default),"../i18n/da.strings":()=>M(()=>import("./da-DsSrdnBT.js"),[],import.meta.url).then(a=>a.default),"../i18n/de.strings":()=>M(()=>import("./de-CqCSi5uB.js"),[],import.meta.url).then(a=>a.default),"../i18n/el.strings":()=>M(()=>import("./el-DrfOXLmq.js"),[],import.meta.url).then(a=>a.default),"../i18n/en.strings":()=>M(()=>import("./en-DAKqKtlO.js"),[],import.meta.url).then(a=>a.default),"../i18n/es.strings":()=>M(()=>import("./es-CC-_nS8U.js"),[],import.meta.url).then(a=>a.default),"../i18n/fr.strings":()=>M(()=>import("./fr-xxMJQhld.js"),[],import.meta.url).then(a=>a.default),"../i18n/he.strings":()=>M(()=>import("./he-D_sMncu9.js"),[],import.meta.url).then(a=>a.default),"../i18n/it.strings":()=>M(()=>import("./it-CQO8hRgc.js"),[],import.meta.url).then(a=>a.default),"../i18n/ja.strings":()=>M(()=>import("./ja-La_WZu6k.js"),[],import.meta.url).then(a=>a.default),"../i18n/ko.strings":()=>M(()=>import("./ko-DObNRxlY.js"),[],import.meta.url).then(a=>a.default),"../i18n/nb.strings":()=>M(()=>import("./nb-X4VbD4CE.js"),[],import.meta.url).then(a=>a.default),"../i18n/nl.strings":()=>M(()=>import("./nl-CdeYgYYf.js"),[],import.meta.url).then(a=>a.default),"../i18n/pl.strings":()=>M(()=>import("./pl-Jtu3L1c4.js"),[],import.meta.url).then(a=>a.default),"../i18n/pt-PT.strings":()=>M(()=>import("./pt-PT-BKaCFzc4.js"),[],import.meta.url).then(a=>a.default),"../i18n/ru.strings":()=>M(()=>import("./ru-CvjW0r5W.js"),[],import.meta.url).then(a=>a.default),"../i18n/sv.strings":()=>M(()=>import("./sv-29L8cFQi.js"),[],import.meta.url).then(a=>a.default),"../i18n/tr.strings":()=>M(()=>import("./tr-MtsbQ98M.js"),[],import.meta.url).then(a=>a.default),"../i18n/uk.strings":()=>M(()=>import("./uk-BeltaX1a.js"),[],import.meta.url).then(a=>a.default),"../i18n/zh-Hans.strings":()=>M(()=>import("./zh-Hans-B4JA_Azf.js"),[],import.meta.url).then(a=>a.default),"../i18n/zh-Hant.strings":()=>M(()=>import("./zh-Hant-Cv-_Uw4T.js"),[],import.meta.url).then(a=>a.default)});function Z1(a,e){var t;return(t=Object.entries(a).find(([n])=>n.endsWith(e)))==null?void 0:t[1]}function ci(a){const e=new Map,t=a.replace(/\/\*[\s\S]*?\*\//g,"").replace(/^\s*\/\/.*$/gm,""),n=/"((?:[^"\\]|\\.)*)"\s*=\s*"((?:[^"\\]|\\.)*)"\s*;/g,i=s=>s.replace(/\\(u[0-9a-fA-F]{4}|.)/g,(r,o)=>o==="n"?` +`,t}function Cn(a){return a.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}function ei(a){return a.replace(/&/g,"&").replace(//g,">")}function jt(a){return String(a.a<<24|a.r<<16|a.g<<8|a.b|0)}function Ke(a,e){return Array.from(a.children).filter(t=>t.tagName===e)}function L1(a){const e=[];for(const t of Ke(a,"strelem")){const n=ti(t);n&&e.push(n)}return e}function ti(a){const e=je(a,"typ");if(e===void 0||g[e]===void 0)return;const t={type:e,zoomX:je(a,"zx")??0,zoomY:je(a,"zy")??0,textLines:Ke(a,"text").map(o=>N1((o.textContent??"").trim()))},n=Ct(a.getAttribute("textcolor"));n&&(t.textColor=n);const i=Ct(a.getAttribute("bgcolor"));i&&(t.backgroundColor=i),t.textLines.length===0&&(t.textLines=[""]);const s=Ke(a,"schleifeninhalt")[0];if(s){const o=L1(s);o.length>0&&(t.loopBody=o)}const r=Ke(a,"fall").map(o=>({name:N1(o.getAttribute("fallname")??""),elements:L1(o)}));return r.length>0&&(t.cases=r),t}function Pt(a,e){const t=a.getAttribute(e);return t===null?void 0:N1(t)}function je(a,e){const t=a.getAttribute(e);if(!(t===null||!/^[+-]?\d+$/.test(t)))return Number(t)}function Ct(a){if(a===null||!/^[+-]?\d+$/.test(a))return;const e=Number(a);if(e<-2147483648||e>2147483647)return;const t=e>>>0;return{a:t>>>24&255,r:t>>>16&255,g:t>>>8&255,b:t&255}}const ni="http://www.w3.org/2000/svg",L={diagramLineWidth:2,outerFrameLineWidth:2,selectionLineWidth:3.5,canvasOuterMargin:16,cellTextInsetX:18,cellTextInsetY:15,multiHeaderFirstLineY:14,branchLabelInsetX:10,fallauswahlCaseLabelBand:26,callSideBarInset:14,callTextInsetFromSideBar:20,loopBodyLeadingInset:20};function D(a,e={}){const t=document.createElementNS(ni,a);for(const[n,i]of Object.entries(e))t.setAttribute(n,String(i));return t}class An{constructor(e,t){y(this,"usesSimulationHighlight",!1);this.metrics=e,this.measure=t}get lineHeight(){return this.metrics.lineHeight}get fontSize(){return this.metrics.fontSize}render(e,t,n,i=L.canvasOuterMargin){const s=D("svg",{width:t.width,height:t.height,viewBox:`0 0 ${t.width} ${t.height}`,"font-family":p1,"font-size":this.fontSize,class:"diagram"});s.append(D("rect",{x:0,y:0,width:t.width,height:t.height,fill:"#fafafa"}));const r=i;s.append(D("rect",{x:r,y:r,width:e.canvasSize.width-2*r-1,height:e.canvasSize.height-2*r-1,fill:"none",stroke:"black","stroke-width":L.outerFrameLineWidth}));const o=D("g");for(const l of e.elements)this.drawNode(l,o,n,{},void 0);return s.append(o),s}line(e,t){e.append(D("polyline",{points:t.map(n=>n.join(",")).join(" "),fill:"none",stroke:"black","stroke-width":L.diagramLineWidth,"stroke-linejoin":"miter"}))}strokeCellBorder(e,t,n){const i=t.x,s=t.y,r=t.x+t.width,o=t.y+t.height;if(!n.top&&!n.left&&!n.bottom&&!n.right){e.append(D("rect",{x:i,y:s,width:t.width,height:t.height,fill:"none",stroke:"black","stroke-width":L.diagramLineWidth}));return}n.top||this.line(e,[[i,s],[r,s]]),n.right||this.line(e,[[r,s],[r,o]]),n.bottom||this.line(e,[[r,o],[i,o]]),n.left||this.line(e,[[i,o],[i,s]])}textWidth(e){const t=ft(e);return t?this.measure(t.keyword,this.fontSize,"bold")+(t.rest===""?0:this.measure(" "+t.rest,this.fontSize,"medium")):this.measure(e,this.fontSize,"medium")}drawKeywordLine(e,t,n,i){const s=D("text",{x:n,y:i+kt(this.fontSize,"medium").ascent,"font-weight":500});s.style.whiteSpace="pre";const r=ft(t);if(r){const o=D("tspan",{"font-weight":700});if(o.textContent=r.keyword,s.append(o),r.rest!==""){const l=D("tspan",{});l.textContent=" "+r.rest,s.append(l)}}else s.textContent=t;e.append(s)}drawLabel(e,t,n,i,s,r){const o=kt(this.fontSize,s?"bold":"medium"),l=D("text",{x:n,y:r==="top"?i+o.ascent:i-o.descent,"font-weight":s?700:500});l.style.whiteSpace="pre",l.textContent=t,e.append(l)}roofMetrics(e,t,n,i){const s=t.y+n,r=e.dividerYInset??0,o=12,l=Math.max(e.element.textLines.length,1)*this.lineHeight,m=t.y+L.multiHeaderFirstLineY;if(e.element.type===g.fallauswahl){const c=Math.max(L.fallauswahlCaseLabelBand,this.lineHeight+10),h=s-c,p=Math.min(s+r,h-8),x=Math.max(p,m+l+6);return{apex:{x:i,y:x},maxTextBottom:h-o,roofBottom:s}}const u={x:i,y:s+r};return{apex:u,maxTextBottom:u.y-o,roofBottom:s}}drawNode(e,t,n,i,s){var j;const r=e.frame,o=e.element,l=r.x+r.width,m=r.y+r.height,u=o.type===g.verzweigung||o.type===g.fallauswahl,c=u?e.headerBandHeight:0,h=n!==void 0&&V1(e.idPath,n),p=tt(o),x=D("g",{"data-path":e.idPath.join(",")});t.append(x);const f=this.usesSimulationHighlight,I=h&&f?"rgba(199, 230, 255, 0.55)":"white";x.append(D("rect",{x:r.x,y:r.y,width:r.width,height:r.height,fill:I})),this.strokeCellBorder(x,r,i);const v=L.callSideBarInset;if(o.type===g.aufruf?(this.line(x,[[r.x+v,r.y],[r.x+v,m]]),this.line(x,[[l-v,r.y],[l-v,m]])):o.type===g.aussprung&&this.line(x,[[r.x+v,r.y],[r.x,r.y+r.height/2],[r.x+v,m]]),u&&e.dividerX!==void 0){const _=e.dividerX,Z=this.roofMetrics(e,r,c,_),P=Math.max(p.length,1)*this.lineHeight,C=r.y+L.multiHeaderFirstLineY;this.line(x,[[r.x,r.y],[Z.apex.x,Z.apex.y],[l,r.y]]),o.type===g.fallauswahl&&this.line(x,[[r.x,Z.roofBottom],[l,Z.roofBottom]]);let W;C+P<=Z.maxTextBottom?W=C:W=Math.max(r.y+2,Z.maxTextBottom-(Math.max(p.length,1)-1)*this.lineHeight-this.lineHeight),p.forEach((B,oe)=>{const le=this.textWidth(B);let be;if(o.type===g.verzweigung){const v1=r.x+L.cellTextInsetX,Ma=l-le-L.cellTextInsetX;be=Math.min(Math.max(_-le/2,v1),Ma)}else be=r.x+r.width/2-le/2;this.drawKeywordLine(x,B,be,W+oe*this.lineHeight)})}else if(o.type!==g.doUntilSchleife)if(o.type===g.anweisung||o.type===g.aufruf||o.type===g.aussprung){const _=L.cellTextInsetX;let Z=r.x+_,P=l-_;o.type===g.aufruf?(Z=r.x+v+L.callTextInsetFromSideBar,P=l-v-L.callTextInsetFromSideBar):o.type===g.aussprung&&(Z=r.x+v+_);const C=Math.max(0,P-Z);let W=r.y+r.height/2-Math.max(1,p.length)*this.lineHeight/2;for(const B of p)this.drawKeywordLine(x,B,Z+(C-this.textWidth(B))/2,W),W+=this.lineHeight}else{const _=Math.max(1,p.length)*this.lineHeight;let Z=s===g.doUntilSchleife?r.y+r.height/2-_/2:r.y+L.cellTextInsetY;for(const P of p)this.drawKeywordLine(x,P,r.x+L.cellTextInsetX,Z),Z+=this.lineHeight}e.children.forEach((_,Z)=>{const P=o.type===g.doUntilSchleife&&Z===0?{top:!0,left:!0}:{};this.drawNode(_,t,n,P,o.type)});const w=D("g");if(t.append(w),o.type===g.doUntilSchleife){const _=((j=e.children[0])==null?void 0:j.frame.x)??r.x+(e.loopBodyLeadingInset>0?e.loopBodyLeadingInset:L.loopBodyLeadingInset);this.drawLabel(w,"do",r.x+4,r.y+this.metrics.doUntilDoLabelTopInset,!0,"top");const Z=m-e.headerBandHeight;this.line(w,[[_,Z],[l,Z]]),this.line(w,[[_,r.y],[_,Z]]);let P=Z+this.metrics.doUntilFooterTopInset;for(const C of p)this.drawKeywordLine(w,C,r.x+L.cellTextInsetX,P),P+=this.lineHeight}if(u&&e.dividerX!==void 0&&e.caseColumnFrames.length>1){const _=this.roofMetrics(e,r,c,e.dividerX),Z=_.apex;e.caseColumnFrames.forEach((C,W)=>{if(W>=e.caseColumnFrames.length-1)return;const B=C.x+C.width,oe=ai(B,r,Z),le=Number.isFinite(oe)?Math.min(Math.max(oe,r.y),m):r.y;this.line(w,[[B,m],[B,le]])});const P=o.cases;if(P&&P.length===e.caseColumnFrames.length){const C=o.type===g.fallauswahl?_.roofBottom-6:r.y+c-8,W=L.branchLabelInsetX;if(o.type===g.verzweigung&&P.length===2){this.drawLabel(w,"true",r.x+W,C,!0,"bottom");const B=e.caseColumnFrames[1],oe=this.measure("false",this.fontSize,"bold");this.drawLabel(w,"false",B.x+B.width-W-oe,C,!0,"bottom")}else P.forEach((B,oe)=>{const le=e.caseColumnFrames[oe],be=["default","true","false"].includes(B.name.toLowerCase()),v1=this.measure(B.name,this.fontSize,be?"bold":"medium");this.drawLabel(w,B.name,le.x+le.width/2-v1/2,C,be,"bottom")})}}h&&w.append(D("rect",{x:r.x,y:r.y,width:r.width,height:r.height,fill:"none",stroke:f?"rgba(66, 140, 242, 0.78)":"rgba(0, 122, 255, 0.9)","stroke-width":L.selectionLineWidth}))}}function ai(a,e,t){const n=e.y;if(a<=t.x){const s=t.x-e.x;return Math.abs(s)<.5?t.y:n+(t.y-n)/s*(a-e.x)}const i=e.x+e.width-t.x;return Math.abs(i)<.5?t.y:t.y+(n-t.y)/i*(a-t.x)}function V1(a,e){return a.length===e.length&&a.every((t,n)=>t===e[n])}function ii(a){const e=[],t=n=>{e.push(n),n.children.forEach(t)};return a.forEach(t),e}function s1(a){var e,t;return{...a,textLines:tt(a),loopBody:(e=a.loopBody)==null?void 0:e.map(s1),cases:(t=a.cases)==null?void 0:t.map(n=>({name:n.name,elements:n.elements.map(s1)}))}}const si="modulepreload",ri=function(a,e){return new URL(a,e).href},At={},M=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){let r=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),m=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=r(t.map(u=>{if(u=ri(u,n),u in At)return;At[u]=!0;const c=u.endsWith(".css"),h=c?'[rel="stylesheet"]':"";if(!!n)for(let f=o.length-1;f>=0;f--){const I=o[f];if(I.href===u&&(!c||I.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${h}`))return;const x=document.createElement("link");if(x.rel=c?"stylesheet":si,c||(x.as="script"),x.crossOrigin="",x.href=u,m&&x.setAttribute("nonce",m),document.head.appendChild(x),c)return new Promise((f,I)=>{x.addEventListener("load",f),x.addEventListener("error",()=>I(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(r){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=r,window.dispatchEvent(o),!o.defaultPrevented)throw r}return i.then(r=>{for(const o of r||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})},oi=[{code:"de",name:"Deutsch"},{code:"en",name:"English"},{code:"es",name:"Español"},{code:"fr",name:"Français"},{code:"it",name:"Italiano"},{code:"pl",name:"Polski"},{code:"tr",name:"Türkçe"},{code:"ko",name:"한국어"},{code:"ja",name:"日本語"},{code:"el",name:"Ελληνικά"},{code:"uk",name:"Українська"},{code:"ar",name:"العربية"},{code:"ru",name:"Русский"},{code:"he",name:"עברית"},{code:"nl",name:"Nederlands"},{code:"sv",name:"Svenska"},{code:"da",name:"Dansk"},{code:"nb",name:"Norsk bokmål"},{code:"zh-Hans",name:"中文(简体)"},{code:"zh-Hant",name:"中文(繁體)"},{code:"pt-PT",name:"Português"},{code:"java",name:"Java (Keywords)"}],Tn=["de","en","pt-PT","java"],Dn=oi.filter(a=>Tn.includes(a.code)),Tt=a=>Tn.includes(a),li=Object.assign({"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/ar.lproj/Localizable.strings":()=>M(()=>import("./Localizable-CxCno28C.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/da.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BAutdlBb.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/de.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DZlyYK1P.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/el.lproj/Localizable.strings":()=>M(()=>import("./Localizable-rqA-20hM.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/en.lproj/Localizable.strings":()=>M(()=>import("./Localizable-Dj42XC1o.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/es.lproj/Localizable.strings":()=>M(()=>import("./Localizable-LSTVB2Q5.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/fr.lproj/Localizable.strings":()=>M(()=>import("./Localizable-ByPZS4RL.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/he.lproj/Localizable.strings":()=>M(()=>import("./Localizable-R-16GCrk.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/it.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DXAPah1g.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/ja.lproj/Localizable.strings":()=>M(()=>import("./Localizable-CkJEmEEP.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/java.lproj/Localizable.strings":()=>M(()=>import("./Localizable-a8HTzUdm.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/ko.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BudCXCER.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/nb.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DSvkBkp-.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/nl.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BJ55WGVD.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/pl.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BYJK0mdR.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/pt-PT.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DvUiKfBy.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/ru.lproj/Localizable.strings":()=>M(()=>import("./Localizable-1QZ0wfvJ.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/sv.lproj/Localizable.strings":()=>M(()=>import("./Localizable-M33nNbEe.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/tr.lproj/Localizable.strings":()=>M(()=>import("./Localizable-BM86Igqt.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/uk.lproj/Localizable.strings":()=>M(()=>import("./Localizable-UGog_aku.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/zh-Hans.lproj/Localizable.strings":()=>M(()=>import("./Localizable-CaVEL1es.js"),[],import.meta.url).then(a=>a.default),"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/zh-Hant.lproj/Localizable.strings":()=>M(()=>import("./Localizable-DqIDp_hh.js"),[],import.meta.url).then(a=>a.default)}),mi=Object.assign({"../../../VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct/Java.strings":()=>M(()=>import("./Java-C92fuLac.js"),[],import.meta.url).then(a=>a.default)}),ui=Object.assign({"../i18n/ar.strings":()=>M(()=>import("./ar-COQZmxPT.js"),[],import.meta.url).then(a=>a.default),"../i18n/da.strings":()=>M(()=>import("./da-Chd6sURw.js"),[],import.meta.url).then(a=>a.default),"../i18n/de.strings":()=>M(()=>import("./de-BqSJbBFG.js"),[],import.meta.url).then(a=>a.default),"../i18n/el.strings":()=>M(()=>import("./el-C7O2XkiD.js"),[],import.meta.url).then(a=>a.default),"../i18n/en.strings":()=>M(()=>import("./en-BU37XAsV.js"),[],import.meta.url).then(a=>a.default),"../i18n/es.strings":()=>M(()=>import("./es-DcQytQNI.js"),[],import.meta.url).then(a=>a.default),"../i18n/fr.strings":()=>M(()=>import("./fr-0goWcne4.js"),[],import.meta.url).then(a=>a.default),"../i18n/he.strings":()=>M(()=>import("./he-iK8j7NgI.js"),[],import.meta.url).then(a=>a.default),"../i18n/it.strings":()=>M(()=>import("./it-DbDiZBco.js"),[],import.meta.url).then(a=>a.default),"../i18n/ja.strings":()=>M(()=>import("./ja-C3rHFfYH.js"),[],import.meta.url).then(a=>a.default),"../i18n/ko.strings":()=>M(()=>import("./ko-Co7zOA8X.js"),[],import.meta.url).then(a=>a.default),"../i18n/nb.strings":()=>M(()=>import("./nb-D7cbcu7D.js"),[],import.meta.url).then(a=>a.default),"../i18n/nl.strings":()=>M(()=>import("./nl-Dq2LX98h.js"),[],import.meta.url).then(a=>a.default),"../i18n/pl.strings":()=>M(()=>import("./pl-AtW6u2Bg.js"),[],import.meta.url).then(a=>a.default),"../i18n/pt-PT.strings":()=>M(()=>import("./pt-PT-DsE2Zies.js"),[],import.meta.url).then(a=>a.default),"../i18n/ru.strings":()=>M(()=>import("./ru-S-OGDMjr.js"),[],import.meta.url).then(a=>a.default),"../i18n/sv.strings":()=>M(()=>import("./sv-BgYrXVSc.js"),[],import.meta.url).then(a=>a.default),"../i18n/tr.strings":()=>M(()=>import("./tr-CrrRFe4L.js"),[],import.meta.url).then(a=>a.default),"../i18n/uk.strings":()=>M(()=>import("./uk-CWUyWuF5.js"),[],import.meta.url).then(a=>a.default),"../i18n/zh-Hans.strings":()=>M(()=>import("./zh-Hans-DxaX4UOg.js"),[],import.meta.url).then(a=>a.default),"../i18n/zh-Hant.strings":()=>M(()=>import("./zh-Hant-DTRor7O5.js"),[],import.meta.url).then(a=>a.default)});function Z1(a,e){var t;return(t=Object.entries(a).find(([n])=>n.endsWith(e)))==null?void 0:t[1]}function ci(a){const e=new Map,t=a.replace(/\/\*[\s\S]*?\*\//g,"").replace(/^\s*\/\/.*$/gm,""),n=/"((?:[^"\\]|\\.)*)"\s*=\s*"((?:[^"\\]|\\.)*)"\s*;/g,i=s=>s.replace(/\\(u[0-9a-fA-F]{4}|.)/g,(r,o)=>o==="n"?` `:o==="t"?" ":o.startsWith("u")&&o.length===5?String.fromCharCode(parseInt(o.slice(1),16)):o);for(const s of t.matchAll(n))e.set(i(s[1]),i(s[2]));return e}async function Dt(a){const e=a==="java"?Z1(mi,"/Java.strings"):Z1(li,`/${a}.lproj/Localizable.strings`),t=Z1(ui,`/${a}.strings`),n=new Map;for(const i of[e,t])if(i)for(const[s,r]of ci(await i()))n.set(s,r);return n}let Wn="en",Bn=new Map,$e=new Map;const Gn="appLanguageCode";function di(){const a=new URLSearchParams(location.search).get("lang");if(a&&Tt(a))return a;try{const e=localStorage.getItem(Gn);if(e&&Tt(e))return e}catch{}for(const e of navigator.languages??[navigator.language]){const t=e.toLowerCase();if(t.startsWith("pt"))return"pt-PT";const n=Dn.find(i=>i.code!=="java"&&i.code===t.split("-")[0]);if(n)return n.code}return"en"}async function Hn(a,e=!0){if($e.size===0&&($e=await Dt("en")),Bn=a==="en"?$e:await Dt(a),Wn=a,e)try{localStorage.setItem(Gn,a)}catch{}const t=document.documentElement;t.lang=a==="java"?"en":a,t.dir=a==="ar"||a==="he"?"rtl":"ltr"}function Se(){return Wn}function d(a,...e){const t=Bn.get(a)??$e.get(a)??a;if(e.length===0)return t;let n=0;return t.replace(/%(?:(\d+)\$)?[@d]/g,(i,s)=>String(e[s?Number(s)-1:n++]??""))}const hi=100;function Nn(a){switch(a.kind){case"finished":return"Simulation finished.";case"infiniteLoopWithoutBody":return"Infinite loop has no body.";case"unsupportedStatement":return`Unsupported statement: ${a.text}`;case"invalidExpression":return`Invalid expression: ${a.text}`;case"unknownVariable":return`Unknown variable: ${a.text}`;case"divisionByZero":return"Division by zero.";case"wholeNumberExpected":return"Please enter a whole number.";case"numberExpected":return"Please enter a number.";case"booleanExpected":return"Please enter true or false.";case"subprogramNotFound":return`No open diagram is called ${a.text}. The call was skipped.`;case"callTooDeep":return"Too many nested calls. Does a subprogram call itself?";case"callArguments":return`The call does not match the header of ${a.text}. Check the values in the parentheses.`;case"missingReturn":return`${a.text} ended without returning a value with return.`;case"other":return a.text}}class J extends Error{constructor(e){super(Nn(e)),this.notice=e}}const Y=a=>new J({kind:"unsupportedStatement",text:a}),S=a=>new J({kind:"invalidExpression",text:a}),ke=a=>new J({kind:"unknownVariable",text:a}),gi=()=>new J({kind:"divisionByZero"});function Wt(a){return a instanceof J?a.notice:{kind:"other",text:a instanceof Error?a.message:String(a)}}function pi(a){if(a===0)return"0";if(!Number.isFinite(a))return Number.isNaN(a)?"nan":a>0?"inf":"-inf";const e=Math.floor(Math.log10(Math.abs(Number(a.toPrecision(12)))));if(e<-4||e>=12){const[n,i]=a.toExponential(11).split("e"),s=n.includes(".")?n.replace(/0+$/,"").replace(/\.$/,""):n,r=Number(i);return`${s}e${r<0?"-":"+"}${String(Math.abs(r)).padStart(2,"0")}`}const t=a.toFixed(Math.max(0,11-e));return t.includes(".")?t.replace(/0+$/,"").replace(/\.$/,""):t}function Bt(a){return Number.isFinite(a)&&Math.round(a)===a?a.toFixed(1):pi(a)}function U(a){switch(a.kind){case"int":return String(a.value);case"double":return Bt(a.value);case"string":return a.value;case"boolean":return String(a.value);case"intArray":return"["+a.value.map(String).join(", ")+"]";case"doubleArray":return"["+a.value.map(Bt).join(", ")+"]";case"stringArray":return"["+a.value.join(", ")+"]";case"booleanArray":return"["+a.value.map(String).join(", ")+"]";case"grid":return"["+xi(a).join(", ")+"]"}}function xi(a){return a.value.map(e=>"["+e.map(t=>U(En(a.elementType,t))).join(", ")+"]")}function En(a,e){switch(a){case"int":return{kind:"int",value:e};case"double":return{kind:"double",value:e};case"string":return{kind:"string",value:e};case"boolean":return{kind:"boolean",value:e}}}function Ii(a){return a==="string"?"":a==="boolean"?!1:0}function R1(a){return a.kind==="intArray"||a.kind==="doubleArray"||a.kind==="stringArray"||a.kind==="booleanArray"||a.kind==="grid"}function bi(a){return a.kind==="int"||a.kind==="double"?a.value:NaN}const ce=a=>({kind:"int",value:a}),te=a=>({kind:"double",value:a}),ot=a=>a!==void 0&&/\s/u.test(a),r1=a=>new RegExp("\\p{L}","u").test(a),Me=a=>new RegExp("\\p{N}","u").test(a);function Pe(a){const e=Array.from(a);return e.length===0||!(r1(e[0])||e[0]==="_")?!1:e.every(t=>r1(t)||Me(t)||t==="_")}function ie(a){switch(a.toLowerCase()){case"int":return"int";case"double":return"double";case"string":return"string";case"char":return"string";case"boolean":case"bool":return"boolean";default:return}}function Gt(a){return a.kind==="int"?"int":a.kind==="double"?"double":a.kind==="boolean"?"boolean":"string"}function q(a){const e=Array.from(a);if(e.length===3&&e[0]==="'"&&e[2]==="'")return e[1];if(!(e.length<2||e[0]!=='"'||e[e.length-1]!=='"'))return e.slice(1,-1).join("").replaceAll('\\"','"').replaceAll("\\n",` -`)}function Ht(a){return a.replaceAll("(int)","").replaceAll("(double)","").trim()}function lt(a){const e=new Array(a.length).fill(!1);let t=0,n=!1,i=!1;return a.forEach((s,r)=>{if(n){i?i=!1:s==="\\"?i=!0:s==='"'&&(n=!1);return}switch(s){case'"':n=!0;break;case"(":case"[":t+=1;break;case")":case"]":t-=1;break;default:e[r]=t===0}}),e}function o1(a,e){const t=Array.from(a),n=Array.from(e),i=lt(t),s=[];let r=[],o=0;for(;ot[o+u]===m)&&i.slice(o,l).every(Boolean)){s.push(r.join("").trim()),r=[],o=l;continue}r.push(t[o]),o+=1}return s.push(r.join("").trim()),s}function fi(a){const e=Array.from(a),t=lt(e);for(let n=0;n=","<=","==","!="].includes(o)&&(i=o)}if(i===void 0&&(e[n]==="<"||e[n]===">")&&(i=e[n]),i===void 0)continue;const s=e.slice(0,n).join("").trim(),r=e.slice(n+i.length).join("").trim();return{lhs:s,op:i,rhs:r}}}function x1(a,e){let t=0,n=!1,i=!1;for(let s=e;se.length||!t.every((r,o)=>e[i+o]===r))continue;const s=i+t.length-1;if(x1(e,s)===e.length-1)return{lhs:e.slice(0,i).join("").trim(),rhs:e.slice(s+1,-1).join("").trim()}}}function Ue(a){const e=a.trim();for(const t of["if","while","until","switch"]){if(!e.startsWith(t))continue;const n=e.slice(t.length);if(!(n===""||ot(n[0])||n[0]==="("))continue;let i=n.trim();const s=Ln(i);return s!==void 0&&(i=s),i===""?"true":i}return e===""?"true":e}function ye(a){const e=a.trim(),t=e.indexOf("[");if(!e.endsWith("]")||t<0)return;const n=e.slice(0,t).trim();if(!Pe(n))return;const i=[];let s=t;for(;s2))return{arrayName:n,indexExpressions:i}}function zi(a){const e=a.trim();if(!e.endsWith(")"))return;const t=/^([A-Za-z_]\w*(?:\s*\[[^\[\]]*\])*|"(?:[^"\\]|\\.)*")\s*\.\s*([A-Za-z_]\w*)\s*\(/u.exec(e);if(!t)return;const n=Array.from(e),i=Array.from(t[0]).length-1;if(x1(n,i)!==n.length-1)return;const s=n.slice(i+1,-1).join("").trim();return{target:t[1],method:t[2],args:s===""?[]:o1(s,",")}}function Nt(a){return Pe(a)||ye(a)!==void 0}function Et(a){const e=[];let t="",n=!1,i=!1,s=0;for(const r of a){if(i){t+=r,i=!1;continue}if(r==="\\"){t+=r,i=!0;continue}if(r==='"'){n=!n,t+=r;continue}if(!n&&r==="("&&(s+=1),!n&&r===")"&&(s-=1),r==="+"&&!n&&s===0){e.push(t),t="";continue}t+=r}if(n)throw S(a);return e.push(t),e}function vi(a){const e=[];let t=0,n="";for(const i of a){if(i==="{"&&(t+=1),i==="}"&&(t-=1),i===","&&t===0){e.push(n),n="";continue}n+=i}return n.trim()!==""&&e.push(n),e}function Lt(a){const e=Array.from(a),t=[];let n=0;for(;n1)throw S(a)}else if(!Me(e[n]))break;n+=1}const o=e.slice(s,n).join("");if(o==="."||!/^[0-9]*\.?[0-9]*$/.test(o))throw S(a);t.push({t:"number",literal:o,value:Number(o)});continue}if(r1(i)||i==="_"){const s=n;for(;n=0&&s=0&&o=0&&sHe(t).trim());return e.length===1&&e[0].includes(";")?Vt(e[0].split(";").map(t=>t.trim())):Vt(e)}const O=a=>a.frame?{frame:a.frame,callPath:a.callPath}:{};function ee(a,e=[],t={}){const n=[],i=s=>n.push(t.frame?{...s,...t}:s);return a.forEach((s,r)=>{const o=[...e,r],l=s.textLines.join(" ").trim();switch(s.type){case g.anweisung:l!==""&&l!=="ø"&&i({path:o,text:l,kind:"statement"});break;case g.verzweigung:i({path:o,text:l||"true",kind:"branch",cases:s.cases});break;case g.fallauswahl:i({path:o,text:l||"0",kind:"switchSelection",cases:s.cases});break;case g.forSchleife:i({path:o,text:l,kind:"forLoopStart",loopBody:s.loopBody,forParts:U1(s.textLines)});break;case g.whileSchleife:i({path:o,text:l||"true",kind:"whileLoop",loopBody:s.loopBody});break;case g.doUntilSchleife:i({path:o,text:l||"true",kind:"doUntilLoop",loopBody:s.loopBody});break;case g.endlosschleife:i({path:o,text:l||"true",kind:"infiniteLoop",loopBody:s.loopBody});break;case g.aussprung:i({path:o,text:l,kind:"jump"});break;case g.aufruf:l!==""&&l!=="ø"&&i({path:o,text:l,kind:"call"});break}}),n}function Si(a,e){const t=a.trim().replaceAll(",",".");switch(e){case"int":if(!/^[+-]?[0-9]+$/.test(t))throw new J({kind:"wholeNumberExpected"});return ce(Number(t));case"double":if(!/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?$/.test(t))throw new J({kind:"numberExpected"});return te(Number(t));case"string":return{kind:"string",value:a};case"boolean":switch(t.toLowerCase()){case"true":case"wahr":return{kind:"boolean",value:!0};case"false":case"falsch":return{kind:"boolean",value:!1};default:throw new J({kind:"booleanExpected"})}}}function Rt(){return{stepIndex:0,variables:new Map,outputLines:[],isHalted:!1}}function ki(a,e){for(let t=0;tt===e.path[n])}function pe(a){const e=/^(void|int|double|String|boolean)\s+([A-Za-z_]\w*)\s*\((.*)\)$/u.exec(He(a));if(!e)return;const t=[];if(e[3].trim()!=="")for(const n of e[3].split(",")){const i=/^(int|double|String|boolean|char)\s*((?:\[\s*\]){0,2})\s+([A-Za-z_]\w*)$/u.exec(n.trim());if(!i)return;const s=(i[2].match(/\[/gu)??[]).length;t.push({type:ie(i[1]),name:i[3],...s>0?{dims:s}:{}})}return{returnType:ie(e[1]),name:e[2],params:t}}function Vn(a){const e=/^(?:(?:(int|double|String|boolean)\s+)?([A-Za-z_]\w*)\s*=\s*)?([A-Za-z_]\w*)\s*\((.*)\)$/u.exec(He(a));if(e)return{targetType:e[1]?ie(e[1]):void 0,target:e[2],name:e[3],args:e[4].trim()===""?[]:o1(e[4],",")}}function l1(a){var t,n;const e=He(a);return((t=pe(e))==null?void 0:t.name)??((n=Vn(e))==null?void 0:n.name)??e.replace(/\(\s*\)$/u,"").trim()}class F1{constructor(e,t=()=>{}){b(this,"steps");b(this,"state",Rt());b(this,"nextFrame",1);b(this,"callDepth",0);b(this,"frames",new Map);this.resolveSubprogram=t,this.steps=ee(e.elements)}get currentStepPath(){const e=this.steps[this.state.stepIndex];return(e==null?void 0:e.callPath)??(e==null?void 0:e.path)}get canStep(){return!this.state.isHalted&&!this.state.inputRequest&&this.state.stepIndex ${U(n)}`}catch(n){this.state.inputErrorNotice=Wt(n);return}this.state.inputRequest=void 0,this.state.inputErrorNotice=void 0,this.state.stepIndex+=1,this.state.notice=this.finishedIfAtEnd()}}finishedIfAtEnd(){return this.state.stepIndex>=this.steps.length?{kind:"finished"}:void 0}splice(e){this.steps.splice(this.state.stepIndex,1,...e)}noticeAfterEntering(e){return e.length>0?void 0:this.finishedIfAtEnd()}executeBranch(e){const t=e.cases;if(!t||t.length<2)throw Y(e.text);const n=Ue(e.text),i=this.evaluateBool(n),s=i?0:1,r=ee(t[s].elements,[...e.path,s],O(e));this.splice(r),this.state.lastTrace=`${n} -> ${i}`,this.state.notice=this.noticeAfterEntering(r)}executeSwitchSelection(e){const t=e.cases;if(!t||t.length===0)throw Y(e.text);const n=Ue(e.text),i=this.evaluateSwitchSelector(n),s=ki(i,t)??t.length-1,r=ee(t[s].elements,[...e.path,s],O(e));this.splice(r),this.state.lastTrace=`${n} -> ${t[s].name}`,this.state.notice=this.noticeAfterEntering(r)}executeForLoopStart(e){const t=U1(e.forParts??[e.text]);t[0]!==""&&this.executeStatement(t[0]),this.splice([{...O(e),path:e.path,text:t[1],kind:"forLoopCondition",loopBody:e.loopBody,forParts:t}])}executeForLoopCondition(e){const t=U1(e.forParts??[e.text]),n=t[1]===""?"true":t[1],i=this.evaluateBool(n);if(this.state.lastTrace=`${n} -> ${i}`,i){const s=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...s,{...O(e),path:e.path,text:t[2],kind:"forLoopIncrement",loopBody:e.loopBody,forParts:t},{...O(e),path:e.path,text:t[1],kind:"forLoopCondition",loopBody:e.loopBody,forParts:t}])}else this.splice([]),this.state.notice=this.finishedIfAtEnd()}executeForLoopIncrement(e){const t=e.text.trim();t!==""&&this.executeIncrement(t),this.splice([])}executeWhileLoop(e){const t=Ue(e.text),n=this.evaluateBool(t);if(this.state.lastTrace=`${t} -> ${n}`,n){const i=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...i,{...O(e),path:e.path,text:e.text,kind:"whileLoop",loopBody:e.loopBody}]),this.state.notice=this.noticeAfterEntering(i)}else this.splice([]),this.state.notice=this.finishedIfAtEnd()}enterDoUntilLoop(e){const t=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...t,{...O(e),path:e.path,text:e.text,kind:"doUntilCondition",loopBody:e.loopBody}]),this.state.notice=this.noticeAfterEntering(t)}executeDoUntilCondition(e){const t=Ue(e.text),n=this.evaluateBool(t);if(this.state.lastTrace=`${t} -> ${n}`,n){const i=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...i,{...O(e),path:e.path,text:e.text,kind:"doUntilCondition",loopBody:e.loopBody}])}else this.splice([]),this.state.notice=this.finishedIfAtEnd()}enterInfiniteLoop(e){const t=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...t,{...O(e),path:e.path,text:e.text,kind:"infiniteLoop",loopBody:e.loopBody}]),this.state.lastTrace="true -> true",this.state.notice=t.length>0?void 0:{kind:"infiniteLoopWithoutBody"}}executeJump(e){const t=e.frame??0,n=o=>o.lengthl===e.path[m]);let i=this.steps.length,s="end";for(let o=this.state.stepIndex+1;o ${s}`,s==="return"&&this.finishFrame(r),this.state.notice=this.finishedIfAtEnd()}executeCall(e){const t=e.text,n=this.resolveSubprogram(l1(t));if(!n){this.splice([]),this.state.lastTrace=`${t} -> ?`,this.state.notice={kind:"subprogramNotFound",text:t},this.state.stepIndex>=this.steps.length&&(this.state.notice={kind:"finished"});return}const i=Vn(t),s=pe(n.caption);if(s?((i==null?void 0:i.args.length)??0)!==s.params.length||(i==null?void 0:i.target)!==void 0&&!s.returnType:i!==void 0&&(i.args.length>0||i.target!==void 0))throw new J({kind:"callArguments",text:(s==null?void 0:s.name)??l1(t)});if(this.callDepth>=hi)throw new J({kind:"callTooDeep"});const o=new Map,l=[];s==null||s.params.forEach((h,p)=>{const x=i.args[p].trim();if(!h.dims){o.set(h.name,this.evaluateExpression(x,h.type));return}const y=this.state.variables.get(x);if(!y)throw/^[A-Za-z_]\w*$/u.test(x)?new J({kind:"unknownVariable",text:x}):S(x);if(!(h.dims===1?y.kind===`${h.type}Array`:y.kind==="grid"&&y.elementType===h.type))throw S(x);o.set(h.name,y),l.push({param:h.name,callerName:x})}),this.callDepth+=1;const m={frame:this.nextFrame++,callPath:e.callPath??e.path};s&&(this.frames.set(m.frame,{saved:this.state.variables,header:s,call:i,references:l}),this.state.variables=o);const u=ee(n.elements,[],m);this.splice([...u,{...m,path:e.path,text:t,kind:"callEnd"}]);const c=s==null?void 0:s.params.map((h,p)=>`${h.name} = ${h.dims?i.args[p].trim():U(o.get(h.name))}`).join(", ");this.state.lastTrace=c?`${t} -> ${c}`:`${t} -> call`}executeCallEnd(e){this.callDepth-=1,this.splice([]),this.state.lastTrace=`${e.text} -> return`,this.finishFrame(e),this.state.notice=this.finishedIfAtEnd()}executeReturn(e){const t=e.frame??0,n=He(e.text).slice(6).trim(),i=this.frames.get(t);if(i&&n!==""){if(!i.header.returnType)throw S(e.text);i.returnValue=this.evaluateExpression(n,i.header.returnType)}const s=i!=null&&i.returnValue?`${e.text} -> ${U(i.returnValue)}`:`${e.text} -> return`;if(t===0){this.steps.splice(this.state.stepIndex),this.state.lastTrace=s,this.state.notice={kind:"finished"};return}let r=this.state.stepIndex+1;for(;r0?new Map(t.saved):t.saved;for(const u of t.references){const c=this.state.variables.get(u.param);c&&n.set(u.callerName,c)}this.state.variables=n;const i=t.returnValue;if(t.header.returnType&&!i)throw new J({kind:"missingReturn",text:t.header.name});const s=(l=t.call)==null?void 0:l.target;if(!s||!i)return;let r=(m=t.call)==null?void 0:m.targetType;if(!r)try{r=this.inferTargetValueType(s)}catch{r=t.header.returnType}const o=r==="double"&&i.kind==="int"?te(i.value):r==="string"?{kind:"string",value:U(i)}:i;if(Gt(o)!==r)throw S(e.text);this.assignValue(o,s),this.state.lastTrace=`${s} = ${e.text.slice(e.text.indexOf("=")+1).trim()} -> ${U(o)}`}executeStatement(e){const t=this.state,n=e.trim(),i=n.toLowerCase();if(i.startsWith("input:")){t.inputRequest=this.parseInputRequest(n),t.inputErrorNotice=void 0;return}if(i.startsWith("output:")||i.startsWith("print:")){const p=n.slice(i.startsWith("output:")?7:6),x=this.renderOutputExpression(p),y=this.evaluateOutputExpression(p);t.outputLines.push(y),t.lastTrace=`${x} -> ${y}`;return}if(n.endsWith("++")||n.endsWith("--")||n.includes("+=")||n.includes("-=")){this.executeIncrement(n);return}const s=n.indexOf("=");if(s<0)throw Y(n);const r=n.slice(0,s).trim(),o=n.slice(s+1),l=this.parseArrayDeclaration(r,o);if(l){t.variables.set(l.name,l.value),t.lastTrace=`${l.name} = new ${l.typeName}[${l.count}]`;return}const m=this.parseAssignmentTarget(r);let u;try{u=this.renderNumericExpression(o)}catch{u=o.trim()}let c=m.valueType;if(!c)try{c=this.inferTargetValueType(m.variableName)}catch{c="int"}const h=this.evaluateExpression(o,c);this.assignValue(h,m.variableName),t.lastTrace=`${m.variableName} = ${u} -> ${U(h)}`}executeIncrement(e){const t=this.state.variables;for(const[n,i]of[["++",1],["--",-1]]){if(!e.endsWith(n))continue;const s=e.slice(0,-2).trim(),r=t.get(s);if(!Pe(s)||!r)throw Y(e);const o=i>0?"+":"-";if(r.kind==="int"){t.set(s,ce(r.value+i)),this.state.lastTrace=`${s} = ${r.value} ${o} 1 -> ${r.value+i}`;return}if(r.kind==="double"){const l=r.value+i;t.set(s,te(l)),this.state.lastTrace=`${s} = ${U(r)} ${o} 1 -> ${U(te(l))}`;return}throw Y(e)}for(const[n,i]of[["+=",1],["-=",-1]]){const s=e.indexOf(n);if(s<0)continue;const r=e.slice(0,s).trim(),o=e.slice(s+2),l=t.get(r);if(!Pe(r)||!l)throw Y(e);const m=i>0?"+":"-";if(l.kind==="int"){const u=this.evaluateInt(o),c=l.value+i*u;t.set(r,ce(c)),this.state.lastTrace=`${r} = ${l.value} ${m} ${u} -> ${c}`;return}if(l.kind==="double"){const u=this.evaluateDouble(o),c=l.value+i*u;t.set(r,te(c)),this.state.lastTrace=`${r} = ${U(l)} ${m} ${U(te(u))} -> ${U(te(c))}`;return}throw Y(e)}this.executeStatement(e)}parseAssignmentTarget(e){if(ye(e))return{variableName:e.trim()};const t=e.split(/\s+/u).filter(Boolean);let n,i;if(t.length===1)n=t[0];else if(t.length===2&&ie(t[0]))n=t[1],i=ie(t[0]);else if(t.length===3&&t[0]==="const"&&ie(t[1]))n=t[2],i=ie(t[1]);else throw Y(e);if(!Nt(n))throw Y(e);return{variableName:n,valueType:i}}parseInputRequest(e){const t=e.slice(6).trim(),n=/^(\S+)(?:\s+(\S+))?(?:\s+([\s\S]*))?$/u.exec(t);if(!n)throw Y(e);const i=[n[1],n[2],n[3]].filter(u=>u!==void 0);let s,r,o;const l=ie(i[0]);if(i.length>=2&&l?(s=i[1],r=l,o=(i[2]??"").trim()):(s=i[0],r=this.inferTargetValueType(s),o=(i[1]??"").trim()),!Nt(s))throw Y(e);const m=q(o)??o;return{variableName:s,valueType:r,prompt:m===""?`${s}:`:m}}parseArrayDeclaration(e,t){const n=e.split(/\s+/u).filter(Boolean);if(n.length!==2||!n[0].endsWith("[]"))return;const i=n[0].endsWith("[][]"),s=n[0].slice(0,i?-4:-2),r=ie(s),o=n[1];if(!r||!Pe(o))throw Y(e);if(i)return this.parseGridDeclaration(o,s,r,t);const l=t.trim();if(l.startsWith("{")&&l.endsWith("}")){const p=l.slice(1,-1).split(",").map(y=>y.trim());let x;switch(r){case"int":x={kind:"intArray",value:p.map(y=>this.evaluateInt(y))};break;case"double":x={kind:"doubleArray",value:p.map(y=>this.evaluateDouble(y))};break;case"string":x={kind:"stringArray",value:p.map(y=>q(y)??this.evaluateOutputExpression(y))};break;case"boolean":x={kind:"booleanArray",value:p.map(y=>this.evaluateBool(y))};break}return{name:o,typeName:s,count:p.length,value:x}}const m=`new ${s}[`;if(!l.startsWith(m)){const p=this.evaluateStringMethod(l);if((p==null?void 0:p.kind)==="stringArray"&&r==="string")return{name:o,typeName:s,count:p.value.length,value:p}}if(!l.startsWith(m)||!l.endsWith("]"))throw Y(t);const u=l.slice(m.length,-1),c=this.evaluateInt(u);if(c<0)throw S(u);const h=r==="int"?{kind:"intArray",value:new Array(c).fill(0)}:r==="double"?{kind:"doubleArray",value:new Array(c).fill(0)}:r==="boolean"?{kind:"booleanArray",value:new Array(c).fill(!1)}:{kind:"stringArray",value:new Array(c).fill("")};return{name:o,typeName:s,count:c,value:h}}parseGridDeclaration(e,t,n,i){var c;const s=i.trim(),r=h=>{switch(n){case"int":return this.evaluateInt(h);case"double":return this.evaluateDouble(h);case"boolean":return this.evaluateBool(h);case"string":return q(h.trim())??this.evaluateOutputExpression(h)}};if(s.startsWith("{")&&s.endsWith("}")){const h=vi(s.slice(1,-1)).map(p=>{const x=p.trim();if(!x.startsWith("{")||!x.endsWith("}"))throw S(x);return x.slice(1,-1).trim()===""?[]:x.slice(1,-1).split(",").map(y=>r(y.trim()))});return{name:e,typeName:t,count:`${h.length}][${((c=h[0])==null?void 0:c.length)??0}`,value:{kind:"grid",elementType:n,value:h}}}const o=new RegExp(String.raw`^new\s+${t}\s*\[(.+)\]\s*\[(.+)\]$`,"u").exec(s);if(!o)throw Y(i);const l=this.evaluateInt(o[1]),m=this.evaluateInt(o[2]);if(l<0)throw S(o[1]);if(m<0)throw S(o[2]);const u={kind:"grid",elementType:n,value:Array.from({length:l},()=>new Array(m).fill(Ii(n)))};return{name:e,typeName:t,count:`${l}][${m}`,value:u}}arrayIndex(e){const t=this.evaluateInt(e);if(t<0)throw S(e);return t}evaluateReference(e){const t=e.trim(),n=this.state.variables.get(t);if(n)return n;const i=this.evaluateStringMethod(t);if(i)return i;const s=ye(t);if(s)return this.valueInArray(s.arrayName,s.indexExpressions.map(r=>this.arrayIndex(r)))}evaluateStringMethod(e){const t=zi(e);if(!t)return;const n=q(t.target)??this.stringValueOf(t.target);if(n===void 0)return;const i=t.args,s=u=>{const c=i[u];if(c===void 0)throw S(e);const h=q(c.trim());if(h!==void 0)return h;const p=this.evaluateReference(c);if((p==null?void 0:p.kind)==="string")return p.value;throw S(c)},r=u=>{if(i[u]===void 0)throw S(e);return this.evaluateInt(i[u])},o=u=>{if(i.length!==u)throw S(e)},l=Array.from(n),m=(u,c)=>{if(u<0||u>c)throw S(e);return u};switch(t.method){case"length":return o(0),ce(l.length);case"charAt":return o(1),{kind:"string",value:l[m(r(0),l.length-1)]};case"substring":{if(i.length!==1&&i.length!==2)throw S(e);const u=m(r(0),l.length),c=i.length===2?m(r(1),l.length):l.length;if(c0&&c[c.length-1]==="";)c.pop();return{kind:"stringArray",value:c}}default:return}}stringValueOf(e){const t=e.trim(),n=this.state.variables.get(t);if(n)return n.kind==="string"?n.value:void 0;const i=ye(t);if(!i)return;const s=this.valueInArray(i.arrayName,i.indexExpressions.map(r=>this.arrayIndex(r)));return s.kind==="string"?s.value:void 0}substituteStringCalls(e){if(!e.includes("("))return e;let t="",n=e;const i=/([A-Za-z_]\w*(?:\[[^\[\]]*\])*|"(?:[^"\\]|\\.)*")\s*\.\s*(length|indexOf)\s*\(/u;for(let s=i.exec(n);s;s=i.exec(n)){const r=s.index+s[0].length-1,o=x1(Array.from(n),Array.from(n.slice(0,r)).length);if(o===void 0)break;const l=Array.from(n),m=l.slice(Array.from(n.slice(0,s.index)).length,o+1).join(""),u=this.evaluateStringMethod(m),c=l.slice(0,Array.from(n.slice(0,s.index)).length).join("");(u==null?void 0:u.kind)==="int"?t+=c+String(u.value):t+=c+m,n=l.slice(o+1).join("")}return t+n}valueInArray(e,t){const n=this.state.variables.get(e);if(!n)throw ke(e);const i=`${e}[${t.join("][")}]`;if(n.kind==="grid"){if(t.length!==2)throw S(i);const r=n.value[t[0]];if(!r||t[1]>=r.length)throw S(i);return En(n.elementType,r[t[1]])}if(t.length!==1)throw S(i);const s=t[0];if(!R1(n))throw S(e);if(s>=n.value.length)throw S(i);switch(n.kind){case"intArray":return ce(n.value[s]);case"doubleArray":return te(n.value[s]);case"stringArray":return{kind:"string",value:n.value[s]};case"booleanArray":return{kind:"boolean",value:n.value[s]};default:throw S(e)}}inferTargetValueType(e){const t=e.trim(),n=this.state.variables.get(t);if(n)return Gt(n);const i=ye(t);if(i){const s=this.state.variables.get(i.arrayName);if(!s)throw ke(i.arrayName);if(s.kind==="intArray")return"int";if(s.kind==="doubleArray")return"double";if(s.kind==="stringArray")return"string";if(s.kind==="booleanArray")return"boolean";if(s.kind==="grid")return s.elementType;throw S(i.arrayName)}throw Y(e)}assignValue(e,t){const n=t.trim(),i=ye(n);if(!i){this.state.variables.set(n,e);return}const s=i.indexExpressions.map(m=>this.arrayIndex(m)),r=this.state.variables.get(i.arrayName);if(!r)throw ke(i.arrayName);if(r.kind==="grid"){if(s.length!==2||s[0]>=r.value.length||s[1]>=r.value[s[0]].length)throw S(n);const m=r.elementType==="double"&&e.kind==="int"||e.kind===r.elementType?e.value:void 0;if(m===void 0||R1(e))throw S(n);const u=r.value.map(c=>[...c]);u[s[0]][s[1]]=m,this.state.variables.set(i.arrayName,{...r,value:u});return}if(s.length!==1)throw S(n);const o=s[0];let l;if(r.kind==="intArray"&&e.kind==="int")l={kind:"intArray",value:[...r.value]};else if(r.kind==="doubleArray"&&(e.kind==="double"||e.kind==="int"))l={kind:"doubleArray",value:[...r.value]};else if(r.kind==="stringArray"&&e.kind==="string")l={kind:"stringArray",value:[...r.value]};else if(r.kind==="booleanArray"&&e.kind==="boolean")l={kind:"booleanArray",value:[...r.value]};else throw S(n);if(o>=l.value.length)throw S(n);l.value[o]=e.value,this.state.variables.set(i.arrayName,l)}evaluateOutputExpression(e){return Et(e).map(t=>{const n=t.trim(),i=q(n);if(i!==void 0)return i;const s=this.evaluateReference(n);return U(s||this.evaluateNumeric(n))}).join("")}renderOutputExpression(e){return Et(e).map(t=>{const n=t.trim();if(q(n)!==void 0)return n;const i=this.evaluateReference(n);if(i)return U(i);try{return this.renderNumericExpression(n)}catch{return n}}).join(" + ")}evaluateExpression(e,t){switch(t){case"int":return ce(this.evaluateInt(e));case"double":return te(this.evaluateDouble(e));case"string":{const n=e.trim(),i=q(n);if(i!==void 0)return{kind:"string",value:i};const s=this.evaluateReference(n);return s?{kind:"string",value:U(s)}:{kind:"string",value:this.evaluateOutputExpression(e)}}case"boolean":return{kind:"boolean",value:this.evaluateBool(e)}}}evaluateNumeric(e){const{v:t,int:n}=this.parser(e).parseNumber();return n||Number.isFinite(t)&&Math.round(t)===t?ce(t):te(t)}parser(e){return new wi(Lt(Ht(this.substituteStringCalls(e))),this.state.variables)}evaluateInt(e){return this.parser(e).parseInt()}evaluateDouble(e){return this.parser(e).parseDouble()}evaluateBool(e){const t=e.trim();if(t==="true")return!0;if(t==="false")return!1;const n=this.evaluateReference(t);if((n==null?void 0:n.kind)==="boolean")return n.value;const i=o1(t,"||");if(i.length>1)return i.some(m=>this.evaluateBool(m));const s=o1(t,"&&");if(s.length>1)return s.every(m=>this.evaluateBool(m));if(t.startsWith("!")&&!t.startsWith("!="))return!this.evaluateBool(t.slice(1));const r=Ln(t);if(r!==void 0)return this.evaluateBool(r);const o=yi(t);if(o)return this.evaluateComparison(o.lhs,"==",o.rhs);const l=fi(t);if(l)return this.evaluateComparison(l.lhs,l.op,l.rhs);if(this.stringOperand(t)!==void 0)throw S(t);return this.evaluateDouble(t)!==0}evaluateComparison(e,t,n){const i=this.booleanOperand(e),s=this.booleanOperand(n);if((i!==void 0||s!==void 0)&&(t==="=="||t==="!=")){const u=i??this.evaluateBool(e),c=s??this.evaluateBool(n);return t==="=="?u===c:u!==c}const r=this.stringOperand(e),o=this.stringOperand(n);let l,m;if(r!==void 0||o!==void 0){if(r===void 0||o===void 0)throw S(`${e} ${t} ${n}`);l=r,m=o}else l=this.evaluateDouble(e),m=this.evaluateDouble(n);switch(t){case"==":return l===m;case"!=":return l!==m;case"<":return l":return l>m;case">=":return l>=m;default:throw S(`${e} ${t} ${n}`)}}booleanOperand(e){const t=e.trim();if(t==="true")return!0;if(t==="false")return!1;const n=this.evaluateReference(t);return(n==null?void 0:n.kind)==="boolean"?n.value:void 0}stringOperand(e){const t=e.trim(),n=q(t);if(n!==void 0)return n;const i=this.evaluateReference(t);return(i==null?void 0:i.kind)==="string"?i.value:void 0}evaluateSwitchSelector(e){const t=e.trim(),n=q(t);if(n!==void 0)return{kind:"text",value:n};const i=this.state.variables.get(t);if(i)switch(i.kind){case"int":return{kind:"int",value:i.value};case"double":return{kind:"int",value:Math.trunc(i.value)};case"string":return{kind:"text",value:i.value};default:throw S(t)}return/^[+-]?[0-9]+$/.test(t)?{kind:"int",value:Number(t)}:{kind:"int",value:this.evaluateInt(t)}}renderNumericExpression(e){return Lt(Ht(e)).map(t=>{if(t.t==="number")return t.literal;if(t.t==="identifier"){const n=this.state.variables.get(t.name);if(!n)throw ke(t.name);return U(n)}return t.t}).join(" ").replaceAll("( ","(").replaceAll(" )",")").replaceAll(" . ",".").replaceAll("[ ","[").replaceAll(" ]","]")}}const Rn={baseIndent:0,indentPerLevel:4,includeDiagramTextAsComments:!1,includeEmptyElseBranch:!0,pseudocodeNote:"Pseudocode – not a runnable program"};function Un(a,e,t={},n=[]){const i=mt(a,e,t);let s="";e==="javascript"&&(s+=`"use strict"; +`)}function Ht(a){return a.replaceAll("(int)","").replaceAll("(double)","").trim()}function lt(a){const e=new Array(a.length).fill(!1);let t=0,n=!1,i=!1;return a.forEach((s,r)=>{if(n){i?i=!1:s==="\\"?i=!0:s==='"'&&(n=!1);return}switch(s){case'"':n=!0;break;case"(":case"[":t+=1;break;case")":case"]":t-=1;break;default:e[r]=t===0}}),e}function o1(a,e){const t=Array.from(a),n=Array.from(e),i=lt(t),s=[];let r=[],o=0;for(;ot[o+u]===m)&&i.slice(o,l).every(Boolean)){s.push(r.join("").trim()),r=[],o=l;continue}r.push(t[o]),o+=1}return s.push(r.join("").trim()),s}function fi(a){const e=Array.from(a),t=lt(e);for(let n=0;n=","<=","==","!="].includes(o)&&(i=o)}if(i===void 0&&(e[n]==="<"||e[n]===">")&&(i=e[n]),i===void 0)continue;const s=e.slice(0,n).join("").trim(),r=e.slice(n+i.length).join("").trim();return{lhs:s,op:i,rhs:r}}}function x1(a,e){let t=0,n=!1,i=!1;for(let s=e;se.length||!t.every((r,o)=>e[i+o]===r))continue;const s=i+t.length-1;if(x1(e,s)===e.length-1)return{lhs:e.slice(0,i).join("").trim(),rhs:e.slice(s+1,-1).join("").trim()}}}function Ue(a){const e=a.trim();for(const t of["if","while","until","switch"]){if(!e.startsWith(t))continue;const n=e.slice(t.length);if(!(n===""||ot(n[0])||n[0]==="("))continue;let i=n.trim();const s=Ln(i);return s!==void 0&&(i=s),i===""?"true":i}return e===""?"true":e}function ye(a){const e=a.trim(),t=e.indexOf("[");if(!e.endsWith("]")||t<0)return;const n=e.slice(0,t).trim();if(!Pe(n))return;const i=[];let s=t;for(;s2))return{arrayName:n,indexExpressions:i}}function zi(a){const e=a.trim();if(!e.endsWith(")"))return;const t=/^([A-Za-z_]\w*(?:\s*\[[^\[\]]*\])*|"(?:[^"\\]|\\.)*")\s*\.\s*([A-Za-z_]\w*)\s*\(/u.exec(e);if(!t)return;const n=Array.from(e),i=Array.from(t[0]).length-1;if(x1(n,i)!==n.length-1)return;const s=n.slice(i+1,-1).join("").trim();return{target:t[1],method:t[2],args:s===""?[]:o1(s,",")}}function Nt(a){return Pe(a)||ye(a)!==void 0}function Et(a){const e=[];let t="",n=!1,i=!1,s=0;for(const r of a){if(i){t+=r,i=!1;continue}if(r==="\\"){t+=r,i=!0;continue}if(r==='"'){n=!n,t+=r;continue}if(!n&&r==="("&&(s+=1),!n&&r===")"&&(s-=1),r==="+"&&!n&&s===0){e.push(t),t="";continue}t+=r}if(n)throw S(a);return e.push(t),e}function vi(a){const e=[];let t=0,n="";for(const i of a){if(i==="{"&&(t+=1),i==="}"&&(t-=1),i===","&&t===0){e.push(n),n="";continue}n+=i}return n.trim()!==""&&e.push(n),e}function Lt(a){const e=Array.from(a),t=[];let n=0;for(;n1)throw S(a)}else if(!Me(e[n]))break;n+=1}const o=e.slice(s,n).join("");if(o==="."||!/^[0-9]*\.?[0-9]*$/.test(o))throw S(a);t.push({t:"number",literal:o,value:Number(o)});continue}if(r1(i)||i==="_"){const s=n;for(;n=0&&s=0&&o=0&&sHe(t).trim());return e.length===1&&e[0].includes(";")?Vt(e[0].split(";").map(t=>t.trim())):Vt(e)}const O=a=>a.frame?{frame:a.frame,callPath:a.callPath}:{};function ee(a,e=[],t={}){const n=[],i=s=>n.push(t.frame?{...s,...t}:s);return a.forEach((s,r)=>{const o=[...e,r],l=s.textLines.join(" ").trim();switch(s.type){case g.anweisung:l!==""&&l!=="ø"&&i({path:o,text:l,kind:"statement"});break;case g.verzweigung:i({path:o,text:l||"true",kind:"branch",cases:s.cases});break;case g.fallauswahl:i({path:o,text:l||"0",kind:"switchSelection",cases:s.cases});break;case g.forSchleife:i({path:o,text:l,kind:"forLoopStart",loopBody:s.loopBody,forParts:U1(s.textLines)});break;case g.whileSchleife:i({path:o,text:l||"true",kind:"whileLoop",loopBody:s.loopBody});break;case g.doUntilSchleife:i({path:o,text:l||"true",kind:"doUntilLoop",loopBody:s.loopBody});break;case g.endlosschleife:i({path:o,text:l||"true",kind:"infiniteLoop",loopBody:s.loopBody});break;case g.aussprung:i({path:o,text:l,kind:"jump"});break;case g.aufruf:l!==""&&l!=="ø"&&i({path:o,text:l,kind:"call"});break}}),n}function Si(a,e){const t=a.trim().replaceAll(",",".");switch(e){case"int":if(!/^[+-]?[0-9]+$/.test(t))throw new J({kind:"wholeNumberExpected"});return ce(Number(t));case"double":if(!/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?$/.test(t))throw new J({kind:"numberExpected"});return te(Number(t));case"string":return{kind:"string",value:a};case"boolean":switch(t.toLowerCase()){case"true":case"wahr":return{kind:"boolean",value:!0};case"false":case"falsch":return{kind:"boolean",value:!1};default:throw new J({kind:"booleanExpected"})}}}function Rt(){return{stepIndex:0,variables:new Map,outputLines:[],isHalted:!1}}function ki(a,e){for(let t=0;tt===e.path[n])}function pe(a){const e=/^(void|int|double|String|boolean)\s+([A-Za-z_]\w*)\s*\((.*)\)$/u.exec(He(a));if(!e)return;const t=[];if(e[3].trim()!=="")for(const n of e[3].split(",")){const i=/^(int|double|String|boolean|char)\s*((?:\[\s*\]){0,2})\s+([A-Za-z_]\w*)$/u.exec(n.trim());if(!i)return;const s=(i[2].match(/\[/gu)??[]).length;t.push({type:ie(i[1]),name:i[3],...s>0?{dims:s}:{}})}return{returnType:ie(e[1]),name:e[2],params:t}}function Vn(a){const e=/^(?:(?:(int|double|String|boolean)\s+)?([A-Za-z_]\w*)\s*=\s*)?([A-Za-z_]\w*)\s*\((.*)\)$/u.exec(He(a));if(e)return{targetType:e[1]?ie(e[1]):void 0,target:e[2],name:e[3],args:e[4].trim()===""?[]:o1(e[4],",")}}function l1(a){var t,n;const e=He(a);return((t=pe(e))==null?void 0:t.name)??((n=Vn(e))==null?void 0:n.name)??e.replace(/\(\s*\)$/u,"").trim()}class F1{constructor(e,t=()=>{}){y(this,"steps");y(this,"state",Rt());y(this,"nextFrame",1);y(this,"callDepth",0);y(this,"frames",new Map);this.resolveSubprogram=t,this.steps=ee(e.elements)}get currentStepPath(){const e=this.steps[this.state.stepIndex];return(e==null?void 0:e.callPath)??(e==null?void 0:e.path)}get canStep(){return!this.state.isHalted&&!this.state.inputRequest&&this.state.stepIndex ${U(n)}`}catch(n){this.state.inputErrorNotice=Wt(n);return}this.state.inputRequest=void 0,this.state.inputErrorNotice=void 0,this.state.stepIndex+=1,this.state.notice=this.finishedIfAtEnd()}}finishedIfAtEnd(){return this.state.stepIndex>=this.steps.length?{kind:"finished"}:void 0}splice(e){this.steps.splice(this.state.stepIndex,1,...e)}noticeAfterEntering(e){return e.length>0?void 0:this.finishedIfAtEnd()}executeBranch(e){const t=e.cases;if(!t||t.length<2)throw Y(e.text);const n=Ue(e.text),i=this.evaluateBool(n),s=i?0:1,r=ee(t[s].elements,[...e.path,s],O(e));this.splice(r),this.state.lastTrace=`${n} -> ${i}`,this.state.notice=this.noticeAfterEntering(r)}executeSwitchSelection(e){const t=e.cases;if(!t||t.length===0)throw Y(e.text);const n=Ue(e.text),i=this.evaluateSwitchSelector(n),s=ki(i,t)??t.length-1,r=ee(t[s].elements,[...e.path,s],O(e));this.splice(r),this.state.lastTrace=`${n} -> ${t[s].name}`,this.state.notice=this.noticeAfterEntering(r)}executeForLoopStart(e){const t=U1(e.forParts??[e.text]);t[0]!==""&&this.executeStatement(t[0]),this.splice([{...O(e),path:e.path,text:t[1],kind:"forLoopCondition",loopBody:e.loopBody,forParts:t}])}executeForLoopCondition(e){const t=U1(e.forParts??[e.text]),n=t[1]===""?"true":t[1],i=this.evaluateBool(n);if(this.state.lastTrace=`${n} -> ${i}`,i){const s=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...s,{...O(e),path:e.path,text:t[2],kind:"forLoopIncrement",loopBody:e.loopBody,forParts:t},{...O(e),path:e.path,text:t[1],kind:"forLoopCondition",loopBody:e.loopBody,forParts:t}])}else this.splice([]),this.state.notice=this.finishedIfAtEnd()}executeForLoopIncrement(e){const t=e.text.trim();t!==""&&this.executeIncrement(t),this.splice([])}executeWhileLoop(e){const t=Ue(e.text),n=this.evaluateBool(t);if(this.state.lastTrace=`${t} -> ${n}`,n){const i=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...i,{...O(e),path:e.path,text:e.text,kind:"whileLoop",loopBody:e.loopBody}]),this.state.notice=this.noticeAfterEntering(i)}else this.splice([]),this.state.notice=this.finishedIfAtEnd()}enterDoUntilLoop(e){const t=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...t,{...O(e),path:e.path,text:e.text,kind:"doUntilCondition",loopBody:e.loopBody}]),this.state.notice=this.noticeAfterEntering(t)}executeDoUntilCondition(e){const t=Ue(e.text),n=this.evaluateBool(t);if(this.state.lastTrace=`${t} -> ${n}`,n){const i=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...i,{...O(e),path:e.path,text:e.text,kind:"doUntilCondition",loopBody:e.loopBody}])}else this.splice([]),this.state.notice=this.finishedIfAtEnd()}enterInfiniteLoop(e){const t=ee(e.loopBody??[],[...e.path,0],O(e));this.splice([...t,{...O(e),path:e.path,text:e.text,kind:"infiniteLoop",loopBody:e.loopBody}]),this.state.lastTrace="true -> true",this.state.notice=t.length>0?void 0:{kind:"infiniteLoopWithoutBody"}}executeJump(e){const t=e.frame??0,n=o=>o.lengthl===e.path[m]);let i=this.steps.length,s="end";for(let o=this.state.stepIndex+1;o ${s}`,s==="return"&&this.finishFrame(r),this.state.notice=this.finishedIfAtEnd()}executeCall(e){const t=e.text,n=this.resolveSubprogram(l1(t));if(!n){this.splice([]),this.state.lastTrace=`${t} -> ?`,this.state.notice={kind:"subprogramNotFound",text:t},this.state.stepIndex>=this.steps.length&&(this.state.notice={kind:"finished"});return}const i=Vn(t),s=pe(n.caption);if(s?((i==null?void 0:i.args.length)??0)!==s.params.length||(i==null?void 0:i.target)!==void 0&&!s.returnType:i!==void 0&&(i.args.length>0||i.target!==void 0))throw new J({kind:"callArguments",text:(s==null?void 0:s.name)??l1(t)});if(this.callDepth>=hi)throw new J({kind:"callTooDeep"});const o=new Map,l=[];s==null||s.params.forEach((h,p)=>{const x=i.args[p].trim();if(!h.dims){o.set(h.name,this.evaluateExpression(x,h.type));return}const f=this.state.variables.get(x);if(!f)throw/^[A-Za-z_]\w*$/u.test(x)?new J({kind:"unknownVariable",text:x}):S(x);if(!(h.dims===1?f.kind===`${h.type}Array`:f.kind==="grid"&&f.elementType===h.type))throw S(x);o.set(h.name,f),l.push({param:h.name,callerName:x})}),this.callDepth+=1;const m={frame:this.nextFrame++,callPath:e.callPath??e.path};s&&(this.frames.set(m.frame,{saved:this.state.variables,header:s,call:i,references:l}),this.state.variables=o);const u=ee(n.elements,[],m);this.splice([...u,{...m,path:e.path,text:t,kind:"callEnd"}]);const c=s==null?void 0:s.params.map((h,p)=>`${h.name} = ${h.dims?i.args[p].trim():U(o.get(h.name))}`).join(", ");this.state.lastTrace=c?`${t} -> ${c}`:`${t} -> call`}executeCallEnd(e){this.callDepth-=1,this.splice([]),this.state.lastTrace=`${e.text} -> return`,this.finishFrame(e),this.state.notice=this.finishedIfAtEnd()}executeReturn(e){const t=e.frame??0,n=He(e.text).slice(6).trim(),i=this.frames.get(t);if(i&&n!==""){if(!i.header.returnType)throw S(e.text);i.returnValue=this.evaluateExpression(n,i.header.returnType)}const s=i!=null&&i.returnValue?`${e.text} -> ${U(i.returnValue)}`:`${e.text} -> return`;if(t===0){this.steps.splice(this.state.stepIndex),this.state.lastTrace=s,this.state.notice={kind:"finished"};return}let r=this.state.stepIndex+1;for(;r0?new Map(t.saved):t.saved;for(const u of t.references){const c=this.state.variables.get(u.param);c&&n.set(u.callerName,c)}this.state.variables=n;const i=t.returnValue;if(t.header.returnType&&!i)throw new J({kind:"missingReturn",text:t.header.name});const s=(l=t.call)==null?void 0:l.target;if(!s||!i)return;let r=(m=t.call)==null?void 0:m.targetType;if(!r)try{r=this.inferTargetValueType(s)}catch{r=t.header.returnType}const o=r==="double"&&i.kind==="int"?te(i.value):r==="string"?{kind:"string",value:U(i)}:i;if(Gt(o)!==r)throw S(e.text);this.assignValue(o,s),this.state.lastTrace=`${s} = ${e.text.slice(e.text.indexOf("=")+1).trim()} -> ${U(o)}`}executeStatement(e){const t=this.state,n=e.trim(),i=n.toLowerCase();if(i.startsWith("input:")){t.inputRequest=this.parseInputRequest(n),t.inputErrorNotice=void 0;return}if(i.startsWith("output:")||i.startsWith("print:")){const p=n.slice(i.startsWith("output:")?7:6),x=this.renderOutputExpression(p),f=this.evaluateOutputExpression(p);t.outputLines.push(f),t.lastTrace=`${x} -> ${f}`;return}if(n.endsWith("++")||n.endsWith("--")||n.includes("+=")||n.includes("-=")){this.executeIncrement(n);return}const s=n.indexOf("=");if(s<0)throw Y(n);const r=n.slice(0,s).trim(),o=n.slice(s+1),l=this.parseArrayDeclaration(r,o);if(l){t.variables.set(l.name,l.value),t.lastTrace=`${l.name} = new ${l.typeName}[${l.count}]`;return}const m=this.parseAssignmentTarget(r);let u;try{u=this.renderNumericExpression(o)}catch{u=o.trim()}let c=m.valueType;if(!c)try{c=this.inferTargetValueType(m.variableName)}catch{c="int"}const h=this.evaluateExpression(o,c);this.assignValue(h,m.variableName),t.lastTrace=`${m.variableName} = ${u} -> ${U(h)}`}executeIncrement(e){const t=this.state.variables;for(const[n,i]of[["++",1],["--",-1]]){if(!e.endsWith(n))continue;const s=e.slice(0,-2).trim(),r=t.get(s);if(!Pe(s)||!r)throw Y(e);const o=i>0?"+":"-";if(r.kind==="int"){t.set(s,ce(r.value+i)),this.state.lastTrace=`${s} = ${r.value} ${o} 1 -> ${r.value+i}`;return}if(r.kind==="double"){const l=r.value+i;t.set(s,te(l)),this.state.lastTrace=`${s} = ${U(r)} ${o} 1 -> ${U(te(l))}`;return}throw Y(e)}for(const[n,i]of[["+=",1],["-=",-1]]){const s=e.indexOf(n);if(s<0)continue;const r=e.slice(0,s).trim(),o=e.slice(s+2),l=t.get(r);if(!Pe(r)||!l)throw Y(e);const m=i>0?"+":"-";if(l.kind==="int"){const u=this.evaluateInt(o),c=l.value+i*u;t.set(r,ce(c)),this.state.lastTrace=`${r} = ${l.value} ${m} ${u} -> ${c}`;return}if(l.kind==="double"){const u=this.evaluateDouble(o),c=l.value+i*u;t.set(r,te(c)),this.state.lastTrace=`${r} = ${U(l)} ${m} ${U(te(u))} -> ${U(te(c))}`;return}throw Y(e)}this.executeStatement(e)}parseAssignmentTarget(e){if(ye(e))return{variableName:e.trim()};const t=e.split(/\s+/u).filter(Boolean);let n,i;if(t.length===1)n=t[0];else if(t.length===2&&ie(t[0]))n=t[1],i=ie(t[0]);else if(t.length===3&&t[0]==="const"&&ie(t[1]))n=t[2],i=ie(t[1]);else throw Y(e);if(!Nt(n))throw Y(e);return{variableName:n,valueType:i}}parseInputRequest(e){const t=e.slice(6).trim(),n=/^(\S+)(?:\s+(\S+))?(?:\s+([\s\S]*))?$/u.exec(t);if(!n)throw Y(e);const i=[n[1],n[2],n[3]].filter(u=>u!==void 0);let s,r,o;const l=ie(i[0]);if(i.length>=2&&l?(s=i[1],r=l,o=(i[2]??"").trim()):(s=i[0],r=this.inferTargetValueType(s),o=(i[1]??"").trim()),!Nt(s))throw Y(e);const m=q(o)??o;return{variableName:s,valueType:r,prompt:m===""?`${s}:`:m}}parseArrayDeclaration(e,t){const n=e.split(/\s+/u).filter(Boolean);if(n.length!==2||!n[0].endsWith("[]"))return;const i=n[0].endsWith("[][]"),s=n[0].slice(0,i?-4:-2),r=ie(s),o=n[1];if(!r||!Pe(o))throw Y(e);if(i)return this.parseGridDeclaration(o,s,r,t);const l=t.trim();if(l.startsWith("{")&&l.endsWith("}")){const p=l.slice(1,-1).split(",").map(f=>f.trim());let x;switch(r){case"int":x={kind:"intArray",value:p.map(f=>this.evaluateInt(f))};break;case"double":x={kind:"doubleArray",value:p.map(f=>this.evaluateDouble(f))};break;case"string":x={kind:"stringArray",value:p.map(f=>q(f)??this.evaluateOutputExpression(f))};break;case"boolean":x={kind:"booleanArray",value:p.map(f=>this.evaluateBool(f))};break}return{name:o,typeName:s,count:p.length,value:x}}const m=`new ${s}[`;if(!l.startsWith(m)){const p=this.evaluateStringMethod(l);if((p==null?void 0:p.kind)==="stringArray"&&r==="string")return{name:o,typeName:s,count:p.value.length,value:p}}if(!l.startsWith(m)||!l.endsWith("]"))throw Y(t);const u=l.slice(m.length,-1),c=this.evaluateInt(u);if(c<0)throw S(u);const h=r==="int"?{kind:"intArray",value:new Array(c).fill(0)}:r==="double"?{kind:"doubleArray",value:new Array(c).fill(0)}:r==="boolean"?{kind:"booleanArray",value:new Array(c).fill(!1)}:{kind:"stringArray",value:new Array(c).fill("")};return{name:o,typeName:s,count:c,value:h}}parseGridDeclaration(e,t,n,i){var c;const s=i.trim(),r=h=>{switch(n){case"int":return this.evaluateInt(h);case"double":return this.evaluateDouble(h);case"boolean":return this.evaluateBool(h);case"string":return q(h.trim())??this.evaluateOutputExpression(h)}};if(s.startsWith("{")&&s.endsWith("}")){const h=vi(s.slice(1,-1)).map(p=>{const x=p.trim();if(!x.startsWith("{")||!x.endsWith("}"))throw S(x);return x.slice(1,-1).trim()===""?[]:x.slice(1,-1).split(",").map(f=>r(f.trim()))});return{name:e,typeName:t,count:`${h.length}][${((c=h[0])==null?void 0:c.length)??0}`,value:{kind:"grid",elementType:n,value:h}}}const o=new RegExp(String.raw`^new\s+${t}\s*\[(.+)\]\s*\[(.+)\]$`,"u").exec(s);if(!o)throw Y(i);const l=this.evaluateInt(o[1]),m=this.evaluateInt(o[2]);if(l<0)throw S(o[1]);if(m<0)throw S(o[2]);const u={kind:"grid",elementType:n,value:Array.from({length:l},()=>new Array(m).fill(Ii(n)))};return{name:e,typeName:t,count:`${l}][${m}`,value:u}}arrayIndex(e){const t=this.evaluateInt(e);if(t<0)throw S(e);return t}evaluateReference(e){const t=e.trim(),n=this.state.variables.get(t);if(n)return n;const i=this.evaluateStringMethod(t);if(i)return i;const s=ye(t);if(s)return this.valueInArray(s.arrayName,s.indexExpressions.map(r=>this.arrayIndex(r)))}evaluateStringMethod(e){const t=zi(e);if(!t)return;const n=q(t.target)??this.stringValueOf(t.target);if(n===void 0)return;const i=t.args,s=u=>{const c=i[u];if(c===void 0)throw S(e);const h=q(c.trim());if(h!==void 0)return h;const p=this.evaluateReference(c);if((p==null?void 0:p.kind)==="string")return p.value;throw S(c)},r=u=>{if(i[u]===void 0)throw S(e);return this.evaluateInt(i[u])},o=u=>{if(i.length!==u)throw S(e)},l=Array.from(n),m=(u,c)=>{if(u<0||u>c)throw S(e);return u};switch(t.method){case"length":return o(0),ce(l.length);case"charAt":return o(1),{kind:"string",value:l[m(r(0),l.length-1)]};case"substring":{if(i.length!==1&&i.length!==2)throw S(e);const u=m(r(0),l.length),c=i.length===2?m(r(1),l.length):l.length;if(c0&&c[c.length-1]==="";)c.pop();return{kind:"stringArray",value:c}}default:return}}stringValueOf(e){const t=e.trim(),n=this.state.variables.get(t);if(n)return n.kind==="string"?n.value:void 0;const i=ye(t);if(!i)return;const s=this.valueInArray(i.arrayName,i.indexExpressions.map(r=>this.arrayIndex(r)));return s.kind==="string"?s.value:void 0}substituteStringCalls(e){if(!e.includes("("))return e;let t="",n=e;const i=/([A-Za-z_]\w*(?:\[[^\[\]]*\])*|"(?:[^"\\]|\\.)*")\s*\.\s*(length|indexOf)\s*\(/u;for(let s=i.exec(n);s;s=i.exec(n)){const r=s.index+s[0].length-1,o=x1(Array.from(n),Array.from(n.slice(0,r)).length);if(o===void 0)break;const l=Array.from(n),m=l.slice(Array.from(n.slice(0,s.index)).length,o+1).join(""),u=this.evaluateStringMethod(m),c=l.slice(0,Array.from(n.slice(0,s.index)).length).join("");(u==null?void 0:u.kind)==="int"?t+=c+String(u.value):t+=c+m,n=l.slice(o+1).join("")}return t+n}valueInArray(e,t){const n=this.state.variables.get(e);if(!n)throw ke(e);const i=`${e}[${t.join("][")}]`;if(n.kind==="grid"){if(t.length!==2)throw S(i);const r=n.value[t[0]];if(!r||t[1]>=r.length)throw S(i);return En(n.elementType,r[t[1]])}if(t.length!==1)throw S(i);const s=t[0];if(!R1(n))throw S(e);if(s>=n.value.length)throw S(i);switch(n.kind){case"intArray":return ce(n.value[s]);case"doubleArray":return te(n.value[s]);case"stringArray":return{kind:"string",value:n.value[s]};case"booleanArray":return{kind:"boolean",value:n.value[s]};default:throw S(e)}}inferTargetValueType(e){const t=e.trim(),n=this.state.variables.get(t);if(n)return Gt(n);const i=ye(t);if(i){const s=this.state.variables.get(i.arrayName);if(!s)throw ke(i.arrayName);if(s.kind==="intArray")return"int";if(s.kind==="doubleArray")return"double";if(s.kind==="stringArray")return"string";if(s.kind==="booleanArray")return"boolean";if(s.kind==="grid")return s.elementType;throw S(i.arrayName)}throw Y(e)}assignValue(e,t){const n=t.trim(),i=ye(n);if(!i){this.state.variables.set(n,e);return}const s=i.indexExpressions.map(m=>this.arrayIndex(m)),r=this.state.variables.get(i.arrayName);if(!r)throw ke(i.arrayName);if(r.kind==="grid"){if(s.length!==2||s[0]>=r.value.length||s[1]>=r.value[s[0]].length)throw S(n);const m=r.elementType==="double"&&e.kind==="int"||e.kind===r.elementType?e.value:void 0;if(m===void 0||R1(e))throw S(n);const u=r.value.map(c=>[...c]);u[s[0]][s[1]]=m,this.state.variables.set(i.arrayName,{...r,value:u});return}if(s.length!==1)throw S(n);const o=s[0];let l;if(r.kind==="intArray"&&e.kind==="int")l={kind:"intArray",value:[...r.value]};else if(r.kind==="doubleArray"&&(e.kind==="double"||e.kind==="int"))l={kind:"doubleArray",value:[...r.value]};else if(r.kind==="stringArray"&&e.kind==="string")l={kind:"stringArray",value:[...r.value]};else if(r.kind==="booleanArray"&&e.kind==="boolean")l={kind:"booleanArray",value:[...r.value]};else throw S(n);if(o>=l.value.length)throw S(n);l.value[o]=e.value,this.state.variables.set(i.arrayName,l)}evaluateOutputExpression(e){return Et(e).map(t=>{const n=t.trim(),i=q(n);if(i!==void 0)return i;const s=this.evaluateReference(n);return U(s||this.evaluateNumeric(n))}).join("")}renderOutputExpression(e){return Et(e).map(t=>{const n=t.trim();if(q(n)!==void 0)return n;const i=this.evaluateReference(n);if(i)return U(i);try{return this.renderNumericExpression(n)}catch{return n}}).join(" + ")}evaluateExpression(e,t){switch(t){case"int":return ce(this.evaluateInt(e));case"double":return te(this.evaluateDouble(e));case"string":{const n=e.trim(),i=q(n);if(i!==void 0)return{kind:"string",value:i};const s=this.evaluateReference(n);return s?{kind:"string",value:U(s)}:{kind:"string",value:this.evaluateOutputExpression(e)}}case"boolean":return{kind:"boolean",value:this.evaluateBool(e)}}}evaluateNumeric(e){const{v:t,int:n}=this.parser(e).parseNumber();return n||Number.isFinite(t)&&Math.round(t)===t?ce(t):te(t)}parser(e){return new wi(Lt(Ht(this.substituteStringCalls(e))),this.state.variables)}evaluateInt(e){return this.parser(e).parseInt()}evaluateDouble(e){return this.parser(e).parseDouble()}evaluateBool(e){const t=e.trim();if(t==="true")return!0;if(t==="false")return!1;const n=this.evaluateReference(t);if((n==null?void 0:n.kind)==="boolean")return n.value;const i=o1(t,"||");if(i.length>1)return i.some(m=>this.evaluateBool(m));const s=o1(t,"&&");if(s.length>1)return s.every(m=>this.evaluateBool(m));if(t.startsWith("!")&&!t.startsWith("!="))return!this.evaluateBool(t.slice(1));const r=Ln(t);if(r!==void 0)return this.evaluateBool(r);const o=yi(t);if(o)return this.evaluateComparison(o.lhs,"==",o.rhs);const l=fi(t);if(l)return this.evaluateComparison(l.lhs,l.op,l.rhs);if(this.stringOperand(t)!==void 0)throw S(t);return this.evaluateDouble(t)!==0}evaluateComparison(e,t,n){const i=this.booleanOperand(e),s=this.booleanOperand(n);if((i!==void 0||s!==void 0)&&(t==="=="||t==="!=")){const u=i??this.evaluateBool(e),c=s??this.evaluateBool(n);return t==="=="?u===c:u!==c}const r=this.stringOperand(e),o=this.stringOperand(n);let l,m;if(r!==void 0||o!==void 0){if(r===void 0||o===void 0)throw S(`${e} ${t} ${n}`);l=r,m=o}else l=this.evaluateDouble(e),m=this.evaluateDouble(n);switch(t){case"==":return l===m;case"!=":return l!==m;case"<":return l":return l>m;case">=":return l>=m;default:throw S(`${e} ${t} ${n}`)}}booleanOperand(e){const t=e.trim();if(t==="true")return!0;if(t==="false")return!1;const n=this.evaluateReference(t);return(n==null?void 0:n.kind)==="boolean"?n.value:void 0}stringOperand(e){const t=e.trim(),n=q(t);if(n!==void 0)return n;const i=this.evaluateReference(t);return(i==null?void 0:i.kind)==="string"?i.value:void 0}evaluateSwitchSelector(e){const t=e.trim(),n=q(t);if(n!==void 0)return{kind:"text",value:n};const i=this.state.variables.get(t);if(i)switch(i.kind){case"int":return{kind:"int",value:i.value};case"double":return{kind:"int",value:Math.trunc(i.value)};case"string":return{kind:"text",value:i.value};default:throw S(t)}return/^[+-]?[0-9]+$/.test(t)?{kind:"int",value:Number(t)}:{kind:"int",value:this.evaluateInt(t)}}renderNumericExpression(e){return Lt(Ht(e)).map(t=>{if(t.t==="number")return t.literal;if(t.t==="identifier"){const n=this.state.variables.get(t.name);if(!n)throw ke(t.name);return U(n)}return t.t}).join(" ").replaceAll("( ","(").replaceAll(" )",")").replaceAll(" . ",".").replaceAll("[ ","[").replaceAll(" ]","]")}}const Rn={baseIndent:0,indentPerLevel:4,includeDiagramTextAsComments:!1,includeEmptyElseBranch:!0,pseudocodeNote:"Pseudocode – not a runnable program"};function Un(a,e,t={},n=[]){const i=mt(a,e,t);let s="";e==="javascript"&&(s+=`"use strict"; `);const r=[a,...e==="java"?[]:n];if(e==="python"&&r.some(ia)&&(s+=`import random @@ -84,11 +84,11 @@ ${o.out}${z(i)}} `:`break; // ${c} `);return}case g.verzweigung:J1(a,e,t,n,i,!1);return;case g.fallauswahl:{const c=a.cases;if(!c||c.length===0)return;d1(r?"match ":"switch (",r?`: `:`) { -`,a.textLines,e,t,n,i,(u=t.live)==null?void 0:u.labels.selector),c.forEach((h,p)=>{const x=p===c.length-1;if(e==="java"){const y=x?"default -> { "+j1(h.name,e)+` +`,a.textLines,e,t,n,i,(u=t.live)==null?void 0:u.labels.selector),c.forEach((h,p)=>{const x=p===c.length-1;if(e==="java"){const f=x?"default -> { "+j1(h.name,e)+` `:"case "+_1(h.name,e)+` -> { -`;i.out+=z(n+s)+y,o(h.elements,n+s*2),i.out+=z(n+s)+`} -`}else if(r){const y=x?"case _:"+j1(h.name,e):"case "+_1(h.name,e)+":";i.out+=z(n+s)+y+` -`,o(h.elements,n+s*2)}else{const y=x?"default:"+j1(h.name,e):"case "+_1(h.name,e)+":";i.out+=z(n+s)+y+` +`;i.out+=z(n+s)+f,o(h.elements,n+s*2),i.out+=z(n+s)+`} +`}else if(r){const f=x?"case _:"+j1(h.name,e):"case "+_1(h.name,e)+":";i.out+=z(n+s)+f+` +`,o(h.elements,n+s*2)}else{const f=x?"default:"+j1(h.name,e):"case "+_1(h.name,e)+":";i.out+=z(n+s)+f+` `,o(h.elements,n+s*2),i.out+=z(n+s*2)+`break; `}}),r||(i.out+=z(n)+`} `);return}case g.forSchleife:if(e==="java"){m();const c=t.live?ra(a.textLines,t.live.labels):ht(a.textLines);i.out+=z(n)+"for ("+c+`) { @@ -127,7 +127,7 @@ Scanner scanner = new Scanner(System.in); `),s&&(r+=`def ${s.name}(${m}): `))}const o={out:""};we(a.elements,e,i,s?i.indentPerLevel:0,o),s&&e!=="python"&&(o.out+=`} `);const l=r.split(` -`).length-1;return{text:la((r+o.out).replace(/\n+$/,""),e),spans:n.spans.map(m=>({...m,from:m.from+l,to:m.to+l}))}}function la(a,e){switch(e){case"javascript":return a.replace(/\.length\(\)/g,".length").replace(/\.contains\(/g,".includes(");case"python":return ss(a).replace(/\b([a-zA-Z_]\w*(?:\[[^[\]]*\])?)\.length(?:\(\)|\b)/g,"len($1)");case"java":return os(a)}}function ss(a){for(let e=0;e<5;e++){const t=ma(a);if(t===a)break;a=t}return a}function ma(a){const e={indexOf:"find",toUpperCase:"upper",toLowerCase:"lower",trim:"strip",startsWith:"startswith",endsWith:"endswith"},t=/([A-Za-z_]\w*(?:\[[^[\]]*\]|\.\w+\(\))*|"(?:[^"\\]|\\.)*")\.(charAt|substring|contains|indexOf|toUpperCase|toLowerCase|trim|startsWith|endsWith)\(/g;let n="",i=0;for(let s=t.exec(a);s;s=t.exec(a)){const r=s.index+s[0].length-1;let o=0,l=-1;for(let h=r;hy==="("?(h+=1,!1):y===")"?(h-=1,!1):y===","&&h===0),x=p<0?[u]:[u.slice(0,p),u.slice(p+1)];c=x.length===2?`${m}[${x[0].trim()}:${x[1].trim()}]`:`${m}[${u.trim()}:]`;break}case"contains":c=`(${u.trim()} in ${m})`;break;default:c=`${m}.${e[s[2]]}(${u})`}n+=a.slice(i,s.index)+c,i=l+1,t.lastIndex=l+1}return n+a.slice(i)}function rs(a){const e="(?:byte|short|int|long|float|double|boolean|char|String)",t=[new RegExp(`\\b(?:final\\s+)?${e}\\s*\\[\\s*\\](?:\\s*\\[\\s*\\])?\\s+([a-zA-Z_]\\w*)\\b`,"g"),new RegExp(`\\b(?:final\\s+)?${e}\\s+([a-zA-Z_]\\w*)\\s*\\[\\s*\\]`,"g")],n=new Set;for(const i of t)for(const s of a.matchAll(i))n.add(s[1].toLowerCase());return n}function os(a){const e=rs(a);return a.replace(/\b([a-zA-Z_]\w*)\.length(?!\()/g,(t,n)=>e.has(n.toLowerCase())?t:`${n}.length()`)}const ls=new Set("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while true false null var record sealed permits yield module open opens requires exports to uses provides with transitive".split(" "));function ua(a){const e=a.trim();if(e==="")return"Main";let t="";return Array.from(e).forEach((n,i)=>{i===0?new RegExp("\\p{L}","u").test(n)||n==="_"||n==="$"?t+=n:new RegExp("\\p{Nd}","u").test(n)?t+="_"+n:t+="_":/[\p{L}\p{M}\p{N}]/u.test(n)||n==="_"||n==="$"?t+=n:t+="_"}),t=t.replace(/_{2,}/g,"_").replace(/^_+|_+$/g,""),t===""?"Main":(new RegExp("^\\p{Nd}","u").test(t)&&(t="_"+t),ls.has(t.toLowerCase())&&(t="_"+t),t)}function Ot(a,e,t={},n=[]){const i={...Rn,...t},s=ua(e),r=[a,...n].filter((w,j,_)=>_.indexOf(w)===j).map(w=>({d:w,header:pe(w.caption)})).filter(w=>w.header!==void 0),o=r.map(w=>Y1(w.d,w.header,"java",t,i.indentPerLevel)),l=pe(a.caption),m=r.some(w=>c1(w.d)),u=Un(a,"java",i),c=i.indentPerLevel*2,h=c1(a),p=h?ms(u):u,x=z(c),y=p.trim()===""?"":p.split(` +`).length-1;return{text:la((r+o.out).replace(/\n+$/,""),e),spans:n.spans.map(m=>({...m,from:m.from+l,to:m.to+l}))}}function la(a,e){switch(e){case"javascript":return a.replace(/\.length\(\)/g,".length").replace(/\.contains\(/g,".includes(");case"python":return ss(a).replace(/\b([a-zA-Z_]\w*(?:\[[^[\]]*\])?)\.length(?:\(\)|\b)/g,"len($1)");case"java":return os(a)}}function ss(a){for(let e=0;e<5;e++){const t=ma(a);if(t===a)break;a=t}return a}function ma(a){const e={indexOf:"find",toUpperCase:"upper",toLowerCase:"lower",trim:"strip",startsWith:"startswith",endsWith:"endswith"},t=/([A-Za-z_]\w*(?:\[[^[\]]*\]|\.\w+\(\))*|"(?:[^"\\]|\\.)*")\.(charAt|substring|contains|indexOf|toUpperCase|toLowerCase|trim|startsWith|endsWith)\(/g;let n="",i=0;for(let s=t.exec(a);s;s=t.exec(a)){const r=s.index+s[0].length-1;let o=0,l=-1;for(let h=r;hf==="("?(h+=1,!1):f===")"?(h-=1,!1):f===","&&h===0),x=p<0?[u]:[u.slice(0,p),u.slice(p+1)];c=x.length===2?`${m}[${x[0].trim()}:${x[1].trim()}]`:`${m}[${u.trim()}:]`;break}case"contains":c=`(${u.trim()} in ${m})`;break;default:c=`${m}.${e[s[2]]}(${u})`}n+=a.slice(i,s.index)+c,i=l+1,t.lastIndex=l+1}return n+a.slice(i)}function rs(a){const e="(?:byte|short|int|long|float|double|boolean|char|String)",t=[new RegExp(`\\b(?:final\\s+)?${e}\\s*\\[\\s*\\](?:\\s*\\[\\s*\\])?\\s+([a-zA-Z_]\\w*)\\b`,"g"),new RegExp(`\\b(?:final\\s+)?${e}\\s+([a-zA-Z_]\\w*)\\s*\\[\\s*\\]`,"g")],n=new Set;for(const i of t)for(const s of a.matchAll(i))n.add(s[1].toLowerCase());return n}function os(a){const e=rs(a);return a.replace(/\b([a-zA-Z_]\w*)\.length(?!\()/g,(t,n)=>e.has(n.toLowerCase())?t:`${n}.length()`)}const ls=new Set("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while true false null var record sealed permits yield module open opens requires exports to uses provides with transitive".split(" "));function ua(a){const e=a.trim();if(e==="")return"Main";let t="";return Array.from(e).forEach((n,i)=>{i===0?new RegExp("\\p{L}","u").test(n)||n==="_"||n==="$"?t+=n:new RegExp("\\p{Nd}","u").test(n)?t+="_"+n:t+="_":/[\p{L}\p{M}\p{N}]/u.test(n)||n==="_"||n==="$"?t+=n:t+="_"}),t=t.replace(/_{2,}/g,"_").replace(/^_+|_+$/g,""),t===""?"Main":(new RegExp("^\\p{Nd}","u").test(t)&&(t="_"+t),ls.has(t.toLowerCase())&&(t="_"+t),t)}function Ot(a,e,t={},n=[]){const i={...Rn,...t},s=ua(e),r=[a,...n].filter((w,j,_)=>_.indexOf(w)===j).map(w=>({d:w,header:pe(w.caption)})).filter(w=>w.header!==void 0),o=r.map(w=>Y1(w.d,w.header,"java",t,i.indentPerLevel)),l=pe(a.caption),m=r.some(w=>c1(w.d)),u=Un(a,"java",i),c=i.indentPerLevel*2,h=c1(a),p=h?ms(u):u,x=z(c),f=p.trim()===""?"":p.split(` `).map(w=>w.trim()===""?x:x+w).join(` `);let I="";const v=o.length>0&&(h||m);(h||m)&&(I+=`import java.util.Scanner; @@ -136,8 +136,8 @@ Scanner scanner = new Scanner(System.in); `),l||(I+=z(i.indentPerLevel)+`public static void main(String[] args) { `,h&&!v&&(I+=z(c)+`Scanner scanner = new Scanner(System.in); -`,y!==""&&(I+=` -`)),I+=y,y!==""&&!y.endsWith(` +`,f!==""&&(I+=` +`)),I+=f,f!==""&&!f.endsWith(` `)&&(I+=` `),I+=z(i.indentPerLevel)+`} `);for(const[w,j]of o.entries())I+=(w>0||!l?` @@ -176,7 +176,7 @@ onmessage = async (e) => { send('error', String(err)) } } -`,P1=2e3;class gs{constructor(e,t,n,i,s=()=>[]){b(this,"element");b(this,"target");b(this,"javaMode");b(this,"comments");b(this,"emptyElse");b(this,"code","");b(this,"codeView");b(this,"javaModeRow");b(this,"runButton");b(this,"saveButton");b(this,"copyButton");b(this,"runner");b(this,"runOutput");b(this,"runInput");b(this,"pseudocodeBox");b(this,"pseudocodeHint");b(this,"worker");b(this,"outputLines",[]);b(this,"droppedLines",0);b(this,"outputFrame");b(this,"pendingAnswer");this.currentDocument=e,this.saveFile=t,this.onClose=n,this.setPseudocode=i,this.subprograms=s;const r=Fe(me.target);this.target=r==="python"||r==="javascript"?r:"java",this.javaMode=Fe(me.javaMode)==="class"?"class":"snippet",this.comments=Fe(me.comments)==="true",this.emptyElse=Fe(me.emptyElse)!=="false",this.element=document.createElement("aside"),this.element.className="codepanel",this.build()}refresh(){const e=this.currentDocument(),t=this.options();this.code=this.target==="java"&&this.javaMode==="class"?Ot(e,this.classStem(),t,this.subprograms()):Un(e,this.target,t,this.subprograms()),this.codeView.textContent=this.code,this.javaModeRow.hidden=this.target!=="java",this.saveButton.hidden=this.target!=="java",this.runButton.hidden=this.target!=="javascript"||!!e.pseudocode,this.runButton.hidden&&this.stopRun(!0),this.pseudocodeBox.checked=!!e.pseudocode,this.pseudocodeHint.hidden=!e.pseudocode;for(const n of this.element.querySelectorAll("[data-target]"))n.setAttribute("aria-pressed",String(n.dataset.target===this.target));for(const n of this.element.querySelectorAll("[data-java-mode]"))n.setAttribute("aria-pressed",String(n.dataset.javaMode===this.javaMode))}close(){this.stopRun(!0)}options(){return{includeDiagramTextAsComments:this.comments,includeEmptyElseBranch:this.emptyElse,pseudocodeNote:d("codegen_pseudocode_note")}}classStem(){return l1(this.currentDocument().caption)||"Main"}build(){this.element.innerHTML=` +`,P1=2e3;class gs{constructor(e,t,n,i,s=()=>[]){y(this,"element");y(this,"target");y(this,"javaMode");y(this,"comments");y(this,"emptyElse");y(this,"code","");y(this,"codeView");y(this,"javaModeRow");y(this,"runButton");y(this,"saveButton");y(this,"copyButton");y(this,"runner");y(this,"runOutput");y(this,"runInput");y(this,"pseudocodeBox");y(this,"pseudocodeHint");y(this,"worker");y(this,"outputLines",[]);y(this,"droppedLines",0);y(this,"outputFrame");y(this,"pendingAnswer");this.currentDocument=e,this.saveFile=t,this.onClose=n,this.setPseudocode=i,this.subprograms=s;const r=Fe(me.target);this.target=r==="python"||r==="javascript"?r:"java",this.javaMode=Fe(me.javaMode)==="class"?"class":"snippet",this.comments=Fe(me.comments)==="true",this.emptyElse=Fe(me.emptyElse)!=="false",this.element=document.createElement("aside"),this.element.className="codepanel",this.build()}refresh(){const e=this.currentDocument(),t=this.options();this.code=this.target==="java"&&this.javaMode==="class"?Ot(e,this.classStem(),t,this.subprograms()):Un(e,this.target,t,this.subprograms()),this.codeView.textContent=this.code,this.javaModeRow.hidden=this.target!=="java",this.saveButton.hidden=this.target!=="java",this.runButton.hidden=this.target!=="javascript"||!!e.pseudocode,this.runButton.hidden&&this.stopRun(!0),this.pseudocodeBox.checked=!!e.pseudocode,this.pseudocodeHint.hidden=!e.pseudocode;for(const n of this.element.querySelectorAll("[data-target]"))n.setAttribute("aria-pressed",String(n.dataset.target===this.target));for(const n of this.element.querySelectorAll("[data-java-mode]"))n.setAttribute("aria-pressed",String(n.dataset.javaMode===this.javaMode))}close(){this.stopRun(!0)}options(){return{includeDiagramTextAsComments:this.comments,includeEmptyElseBranch:this.emptyElse,pseudocodeNote:d("codegen_pseudocode_note")}}classStem(){return l1(this.currentDocument().caption)||"Main"}build(){this.element.innerHTML=`

${V(d("codegen_placeholder_title"))}

@@ -443,7 +443,7 @@ Der Editor besteht aus vier Bereichen. Fahre mit der Maus über ein blaues Wort - **In der Mitte das [Struktogramm](#zeige-struktogramm):** Ein neues Diagramm enthält nur einen leeren Platzhalter, erkennbar an **ø**. - **Unten der [Objektinspektor](#zeige-objektinspektor):** Hier bearbeitest du den Text des ausgewählten Elements. -> Diesen Lernbereich kannst du jederzeit über [Lernen](#zeige-lernen) in der Leiste ein- und ausblenden. Er bleibt neben dem Editor offen, damit du gleich ausprobieren kannst, was du liest. +> Diesen Lernbereich kannst du jederzeit mit dem [Seitenleisten-Symbol](#zeige-lernen) oben in diesem Bereich einklappen. Dann bleibt links nur die schmale Leiste „🎓 Lernen“, ein Klick darauf öffnet ihn wieder. Er bleibt neben dem Editor offen, damit du gleich ausprobieren kannst, was du liest. ## Ein Element einfügen @@ -3885,7 +3885,7 @@ The editor has four areas. Move the mouse over a blue word or tap it, and that a - **In the middle, the [structure chart](#zeige-struktogramm):** A new diagram contains only an empty placeholder, marked with **ø**. - **At the bottom, the [Object Inspector](#zeige-objektinspektor):** Here you edit the text of the selected element. -> You can show and hide this learning area at any time with [Learn](#zeige-lernen) in the toolbar. It stays open next to the editor so you can try out right away what you read. +> You can collapse this learning area at any time with the [sidebar icon](#zeige-lernen) at the top of this area. Then only the slim “🎓 Learn” strip stays on the left; click it to open the area again. It stays open next to the editor so you can try out right away what you read. ## Insert an element @@ -7335,7 +7335,7 @@ O editor tem quatro áreas. Passa o rato por cima de uma palavra azul ou toca ne - **Ao meio, o [estrutograma](#zeige-struktogramm):** Um diagrama novo contém apenas um marcador vazio, assinalado com **ø**. - **Em baixo, o [Inspetor de objetos](#zeige-objektinspektor):** Aqui editas o texto do elemento selecionado. -> Podes mostrar e ocultar esta área de aprendizagem a qualquer momento com [Aprender](#zeige-lernen) na barra de ferramentas. Ela fica aberta ao lado do editor, para poderes experimentar logo o que lês. +> Podes recolher esta área de aprendizagem a qualquer momento com o [ícone da barra lateral](#zeige-lernen) no topo desta área. Fica só a barra estreita “🎓 Aprender” à esquerda; um clique abre-a de novo. Ela fica aberta ao lado do editor, para poderes experimentar logo o que lês. ## Inserir um elemento @@ -20842,7 +20842,7 @@ lösung: aufgabe-verdoppeln-loesung.visustruct `);let n=0;for(;n${Ia(o.join(` `))}`);continue}const s=/^(#{3,4})\s+(.*)$/.exec(i);if(s){const o=s[1].length;e.push(`${X(s[2])}`),n++;continue}if(/^\s*([-*]|\d+\.)\s+/.test(i)){const o=/^\s*\d+\./.test(i),l=[];for(;n${X(m)}`)}e.push(o?`
    ${l.join("")}
`:`
    ${l.join("")}
`);continue}if(i.startsWith("|")&&/^\|?[\s:|-]*-{3,}[\s:|-]*$/.test(t[n+1]??"")){const o=u=>u.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(c=>X(c.trim())),l=o(i);n+=2;const m=[];for(;n${l.map(u=>``).join("")}${m.map(u=>`${u.map(c=>``).join("")}`).join("")}
${u}
${c}
`);continue}if(i.startsWith(">")){const o=[];for(;n");)o.push(t[n++].replace(/^>\s?/,""));e.push(``);continue}const r=[];for(;n|\||\s*([-*]|\d+\.)\s+)/.test(t[n]);)r.push(t[n++].trim());e.push(`

${X(r.join(" "))}

`)}return e.join(` -`)}const x3=""+new URL("ludwig-Cus1i402.webp",import.meta.url).href,ba="visustruct.learn.progress",C1={"04-sequenz":"05-sequenz","05-variablen-und-datentypen":"04-variablen-und-datentypen","07-verzweigung":"08-verzweigung","08-bedingungen-verknuepfen":"09-bedingungen-verknuepfen","09-fallauswahl":"10-fallauswahl","10-while-schleife":"11-while-schleife","11-do-while-schleife":"12-do-while-schleife","12-for-schleife":"13-for-schleife","13-verschachteln":"14-verschachteln","14-arrays":"15-arrays","15-aufruf-und-aussprung":"18-aufruf-und-aussprung","16-aufruf-und-aussprung":"18-aufruf-und-aussprung","17-aufruf-und-aussprung":"18-aufruf-und-aussprung","17-suchen-und-sortieren":"19-suchen-und-sortieren","18-suchen-und-sortieren":"19-suchen-und-sortieren","16-simulation-und-schreibtischtest":"07-simulation-und-schreibtischtest","17-java":"20-java","18-java":"20-java","19-java":"20-java","18-python-und-javascript":"21-python-und-javascript","19-python-und-javascript":"21-python-und-javascript","20-python-und-javascript":"21-python-und-javascript"};function I3(a){var n;const e={...a.lessons};for(const[i,s]of Object.entries(C1))a.lessons[i]&&!a.lessons[s]&&(e[s]=a.lessons[i]),a.lessons[i]&&delete e[i];const t=(n=a.view)!=null&&n.lesson&&C1[a.view.lesson]?{...a.view,lesson:C1[a.view.lesson]}:a.view;return{...a,lessons:e,view:t}}function fa(){try{const a=localStorage.getItem(ba);if(a){const e=JSON.parse(a);return I3({lessons:e.lessons??{},exercises:e.exercises??{},view:e.view})}}catch{}return{lessons:{},exercises:{}}}let ae=fa();function Oe(){try{localStorage.setItem(ba,JSON.stringify(ae))}catch{}}const H={lesson(a){var e;return(e=ae.lessons)[a]??(e[a]={step:0})},updateLesson(a,e){ae.lessons[a]={...H.lesson(a),...e},Oe()},exercise(a){return ae.exercises[a]??{}},updateExercise(a,e){ae.exercises[a]={...H.exercise(a),...e},Oe()},resetExercise(a){delete ae.exercises[a],Oe()},view(){return ae.view},setView(a){ae.view=a,Oe()},reload(){ae=fa()}},$1="f4ecc8e489ae7865308288c7d0fa313333cf2be3ff529b23bc214bee010310e0",It="visustruct.learn.teacher";let bt=!1;function en(){if(bt)return!0;try{return localStorage.getItem(It)===$1}catch{return!1}}async function b3(a){const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(a));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}async function f3(a){let e=!1;try{e=await b3(a.trim())===$1}catch{return!1}if(e){bt=!0;try{localStorage.setItem(It,$1)}catch{}}return e}function y3(){bt=!1;try{localStorage.removeItem(It)}catch{}}function et(a){switch(a.kind){case"finished":return d("sim_notice_finished");case"infiniteLoopWithoutBody":return d("sim_notice_infinite_loop_empty");case"unsupportedStatement":return d("sim_notice_unsupported_statement_fmt",a.text);case"invalidExpression":return d("sim_notice_invalid_expression_fmt",a.text);case"unknownVariable":return d("sim_notice_unknown_variable_fmt",a.text);case"divisionByZero":return d("sim_notice_division_by_zero");case"wholeNumberExpected":return d("sim_notice_whole_number_expected");case"numberExpected":return d("sim_notice_number_expected");case"booleanExpected":return d("sim_notice_boolean_expected");case"subprogramNotFound":return d("sim_notice_subprogram_not_found_fmt",a.text);case"callTooDeep":return d("sim_notice_call_too_deep");case"callArguments":return d("web_sim_call_arguments_fmt",a.text);case"missingReturn":return d("web_sim_missing_return_fmt",a.text);case"other":return a.text}}const G=a=>a.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""),tn=["0.2","0.5","1.0","1.5","2.0"],z3=a=>Number(a).toLocaleString(Se()==="java"?"en":Se(),{minimumFractionDigits:1}),A1="visustruct.simulation.stepDelay",nn="visustruct.simulation.highlightMode";function T1(a){try{return localStorage.getItem(a)}catch{return null}}function an(a,e){try{localStorage.setItem(a,e)}catch{}}class v3{constructor(e,t,n=()=>{},i=()=>{}){b(this,"element");b(this,"engine");b(this,"isPlaying",!1);b(this,"playTimer");b(this,"wasPlayingBeforeInput",!1);b(this,"delay",tn.includes(T1(A1)??"")?T1(A1):"0.5");b(this,"highlightMode",T1(nn)==="nextToExecute"?"nextToExecute":"lastExecuted");b(this,"buttons");b(this,"inputSection");b(this,"trace");b(this,"variables");b(this,"output");b(this,"notice");b(this,"editButton");this.currentDocument=e,this.onHighlight=t,this.findSubprogram=n,this.onEdit=i,this.engine=new F1(e(),n),this.element=document.createElement("aside"),this.element.className="simpanel",this.build()}begin(){this.pause(),this.restartEngine()}end(){this.pause()}step(){if(!this.engine.canStep){this.pause();return}const e=this.isPlaying,t=this.engine.currentStepPath;this.engine.step(),this.highlightMode==="nextToExecute"&&this.engine.canStep?this.onHighlight(this.engine.currentStepPath):this.onHighlight(t??this.engine.currentStepPath),this.engine.state.inputRequest&&e&&(this.wasPlayingBeforeInput=!0),this.engine.canStep||this.pause(),this.update()}reset(){this.pause(),this.restartEngine()}play(){if(this.isPlaying||!this.engine.canStep)return;this.isPlaying=!0;const e=()=>{this.playTimer=void 0,this.isPlaying&&(this.step(),this.isPlaying&&this.engine.canStep?this.playTimer=window.setTimeout(e,Number(this.delay)*1e3):(this.isPlaying=!1,this.update()))};e()}pause(){this.playTimer!==void 0&&window.clearTimeout(this.playTimer),this.playTimer=void 0,this.isPlaying=!1,this.update()}submitInput(e){const t=this.isPlaying||this.wasPlayingBeforeInput;this.pause(),this.engine.provideInput(e.value),this.engine.state.inputRequest||(e.value=""),this.onHighlight(this.engine.currentStepPath),t&&this.engine.canStep&&(this.wasPlayingBeforeInput=!1,this.play()),this.update()}restartEngine(){this.engine=new F1(this.currentDocument(),this.findSubprogram),this.wasPlayingBeforeInput=!1,this.onHighlight(this.engine.currentStepPath),this.update()}build(){this.element.innerHTML=` +`)}const x3=""+new URL("ludwig-Cus1i402.webp",import.meta.url).href,ba="visustruct.learn.progress",C1={"04-sequenz":"05-sequenz","05-variablen-und-datentypen":"04-variablen-und-datentypen","07-verzweigung":"08-verzweigung","08-bedingungen-verknuepfen":"09-bedingungen-verknuepfen","09-fallauswahl":"10-fallauswahl","10-while-schleife":"11-while-schleife","11-do-while-schleife":"12-do-while-schleife","12-for-schleife":"13-for-schleife","13-verschachteln":"14-verschachteln","14-arrays":"15-arrays","15-aufruf-und-aussprung":"18-aufruf-und-aussprung","16-aufruf-und-aussprung":"18-aufruf-und-aussprung","17-aufruf-und-aussprung":"18-aufruf-und-aussprung","17-suchen-und-sortieren":"19-suchen-und-sortieren","18-suchen-und-sortieren":"19-suchen-und-sortieren","16-simulation-und-schreibtischtest":"07-simulation-und-schreibtischtest","17-java":"20-java","18-java":"20-java","19-java":"20-java","18-python-und-javascript":"21-python-und-javascript","19-python-und-javascript":"21-python-und-javascript","20-python-und-javascript":"21-python-und-javascript"};function I3(a){var n;const e={...a.lessons};for(const[i,s]of Object.entries(C1))a.lessons[i]&&!a.lessons[s]&&(e[s]=a.lessons[i]),a.lessons[i]&&delete e[i];const t=(n=a.view)!=null&&n.lesson&&C1[a.view.lesson]?{...a.view,lesson:C1[a.view.lesson]}:a.view;return{...a,lessons:e,view:t}}function fa(){try{const a=localStorage.getItem(ba);if(a){const e=JSON.parse(a);return I3({lessons:e.lessons??{},exercises:e.exercises??{},view:e.view})}}catch{}return{lessons:{},exercises:{}}}let ae=fa();function Oe(){try{localStorage.setItem(ba,JSON.stringify(ae))}catch{}}const H={lesson(a){var e;return(e=ae.lessons)[a]??(e[a]={step:0})},updateLesson(a,e){ae.lessons[a]={...H.lesson(a),...e},Oe()},exercise(a){return ae.exercises[a]??{}},updateExercise(a,e){ae.exercises[a]={...H.exercise(a),...e},Oe()},resetExercise(a){delete ae.exercises[a],Oe()},view(){return ae.view},setView(a){ae.view=a,Oe()},reload(){ae=fa()}},$1="f4ecc8e489ae7865308288c7d0fa313333cf2be3ff529b23bc214bee010310e0",It="visustruct.learn.teacher";let bt=!1;function en(){if(bt)return!0;try{return localStorage.getItem(It)===$1}catch{return!1}}async function b3(a){const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(a));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}async function f3(a){let e=!1;try{e=await b3(a.trim())===$1}catch{return!1}if(e){bt=!0;try{localStorage.setItem(It,$1)}catch{}}return e}function y3(){bt=!1;try{localStorage.removeItem(It)}catch{}}function et(a){switch(a.kind){case"finished":return d("sim_notice_finished");case"infiniteLoopWithoutBody":return d("sim_notice_infinite_loop_empty");case"unsupportedStatement":return d("sim_notice_unsupported_statement_fmt",a.text);case"invalidExpression":return d("sim_notice_invalid_expression_fmt",a.text);case"unknownVariable":return d("sim_notice_unknown_variable_fmt",a.text);case"divisionByZero":return d("sim_notice_division_by_zero");case"wholeNumberExpected":return d("sim_notice_whole_number_expected");case"numberExpected":return d("sim_notice_number_expected");case"booleanExpected":return d("sim_notice_boolean_expected");case"subprogramNotFound":return d("sim_notice_subprogram_not_found_fmt",a.text);case"callTooDeep":return d("sim_notice_call_too_deep");case"callArguments":return d("web_sim_call_arguments_fmt",a.text);case"missingReturn":return d("web_sim_missing_return_fmt",a.text);case"other":return a.text}}const G=a=>a.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""),tn=["0.2","0.5","1.0","1.5","2.0"],z3=a=>Number(a).toLocaleString(Se()==="java"?"en":Se(),{minimumFractionDigits:1}),A1="visustruct.simulation.stepDelay",nn="visustruct.simulation.highlightMode";function T1(a){try{return localStorage.getItem(a)}catch{return null}}function an(a,e){try{localStorage.setItem(a,e)}catch{}}class v3{constructor(e,t,n=()=>{},i=()=>{}){y(this,"element");y(this,"engine");y(this,"isPlaying",!1);y(this,"playTimer");y(this,"wasPlayingBeforeInput",!1);y(this,"delay",tn.includes(T1(A1)??"")?T1(A1):"0.5");y(this,"highlightMode",T1(nn)==="nextToExecute"?"nextToExecute":"lastExecuted");y(this,"buttons");y(this,"inputSection");y(this,"trace");y(this,"variables");y(this,"output");y(this,"notice");y(this,"editButton");this.currentDocument=e,this.onHighlight=t,this.findSubprogram=n,this.onEdit=i,this.engine=new F1(e(),n),this.element=document.createElement("aside"),this.element.className="simpanel",this.build()}begin(){this.pause(),this.restartEngine()}end(){this.pause()}step(){if(!this.engine.canStep){this.pause();return}const e=this.isPlaying,t=this.engine.currentStepPath;this.engine.step(),this.highlightMode==="nextToExecute"&&this.engine.canStep?this.onHighlight(this.engine.currentStepPath):this.onHighlight(t??this.engine.currentStepPath),this.engine.state.inputRequest&&e&&(this.wasPlayingBeforeInput=!0),this.engine.canStep||this.pause(),this.update()}reset(){this.pause(),this.restartEngine()}play(){if(this.isPlaying||!this.engine.canStep)return;this.isPlaying=!0;const e=()=>{this.playTimer=void 0,this.isPlaying&&(this.step(),this.isPlaying&&this.engine.canStep?this.playTimer=window.setTimeout(e,Number(this.delay)*1e3):(this.isPlaying=!1,this.update()))};e()}pause(){this.playTimer!==void 0&&window.clearTimeout(this.playTimer),this.playTimer=void 0,this.isPlaying=!1,this.update()}submitInput(e){const t=this.isPlaying||this.wasPlayingBeforeInput;this.pause(),this.engine.provideInput(e.value),this.engine.state.inputRequest||(e.value=""),this.onHighlight(this.engine.currentStepPath),t&&this.engine.canStep&&(this.wasPlayingBeforeInput=!1,this.play()),this.update()}restartEngine(){this.engine=new F1(this.currentDocument(),this.findSubprogram),this.wasPlayingBeforeInput=!1,this.onHighlight(this.engine.currentStepPath),this.update()}build(){this.element.innerHTML=`

${G(d("simulation_controls"))}

@@ -20867,12 +20867,12 @@ lösung: aufgabe-verdoppeln-loesung.visustruct

${G(d("simulation_trace"))}

${G(d("simulation_variables"))}

${G(d("simulation_output"))}

- `;const e=i=>this.element.querySelector(i);this.buttons={play:e("[data-sim=play]"),pause:e("[data-sim=pause]"),step:e("[data-sim=step]"),stop:e("[data-sim=stop]")},this.buttons.play.addEventListener("click",()=>this.play()),this.buttons.pause.addEventListener("click",()=>this.pause()),this.buttons.step.addEventListener("click",()=>this.step()),this.buttons.stop.addEventListener("click",()=>this.reset()),this.editButton=e(".sim-edit"),this.editButton.addEventListener("click",()=>this.onEdit());const t=e("[data-sim=highlight]");t.value=this.highlightMode,t.addEventListener("change",()=>{this.highlightMode=t.value,an(nn,this.highlightMode)});const n=e("[data-sim=delay]");n.value=this.delay,n.addEventListener("change",()=>{this.delay=n.value,an(A1,this.delay)}),this.inputSection=e(".sim-input > div"),this.trace=e(".sim-trace"),this.variables=e(".sim-vars"),this.output=e(".sim-output"),this.notice=e(".sim-notice")}update(){if(!this.buttons)return;const{state:e,canStep:t}=this.engine;this.buttons.play.disabled=this.isPlaying||!t,this.buttons.pause.disabled=!this.isPlaying,this.buttons.step.disabled=this.isPlaying||!t,this.notice.textContent=e.notice?et(e.notice):"",this.notice.hidden=!e.notice,this.notice.classList.toggle("error",e.isHalted),this.editButton.hidden=!e.isHalted,this.updateInput(),this.trace.textContent=e.lastTrace??d("simulation_trace_placeholder"),this.trace.classList.toggle("placeholder",!e.lastTrace);const n=[...e.variables.keys()].sort((i,s)=>i.localeCompare(s));if(n.length===0)this.variables.innerHTML=`

${G(d("simulation_variables_placeholder"))}

`;else{const i=document.createElement("table");for(const s of n){const r=i.insertRow();r.insertCell().textContent=s;const o=e.variables.get(s),l=r.insertCell();o.kind==="grid"?l.append(w3(o)):l.textContent=U(o)}this.variables.replaceChildren(i)}e.outputLines.length===0?this.output.innerHTML=`

${G(d("simulation_output_placeholder"))}

`:(this.output.replaceChildren(...e.outputLines.map(i=>{const s=document.createElement("div");return s.textContent=i,s})),this.output.scrollTop=this.output.scrollHeight)}updateInput(){const e=this.engine.state.inputRequest,t=this.inputSection;if(t.parentElement.classList.toggle("active",!!e),!e){t.innerHTML=`

${G(d("simulation_input_placeholder"))}

`;return}let n=t.querySelector("form");if(!n){n=document.createElement("form"),n.innerHTML=`

`;const o=n.querySelector("input");n.addEventListener("submit",l=>{l.preventDefault(),this.submitInput(o)}),t.replaceChildren(n),requestAnimationFrame(()=>o.focus())}n.querySelector(".sim-prompt").textContent=e.prompt;const i=n.querySelector("input");i.inputMode=e.valueType==="string"||e.valueType==="boolean"?"text":"decimal";const s=this.engine.state.inputErrorNotice,r=n.querySelector(".sim-input-error");r.textContent=s?et(s):"",r.hidden=!s}}function w3(a){const e=document.createElement("table");e.className="sim-grid";for(const t of a.value){const n=e.insertRow();for(const i of t){const s=n.insertCell();s.textContent=String(i),i===!0&&(s.className="sim-grid-true")}}return e}const S3="code, pre, a, button, h1, h2, h3, h4, strong, .term, .ui-pointer";function sn(a,e){var s;const t=[...a.querySelectorAll(".learn-text")],n=new Set;for(const r of t.flatMap(o=>[...o.querySelectorAll("strong")])){const o=Xt(e),l=o==null?void 0:o.exec(r.textContent??""),m=l?Jt(e,l[0]):void 0;m&&n.add(m)}let i=e.filter(r=>!n.has(r));for(const r of t){const o=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();){const m=o.currentNode;(s=m.parentElement)!=null&&s.closest(S3)||l.push(m)}for(let m of l)for(;;){const u=Xt(i),c=u==null?void 0:u.exec(m.data),h=c?Jt(i,c[0]):void 0;if(!c||!h)break;const p=m.splitText(c.index);m=p.splitText(c[0].length);const x=document.createElement("span");x.className="term",x.tabIndex=0,x.setAttribute("role","button"),x.setAttribute("aria-describedby","term-tip"),x.dataset.term=h.term,x.dataset.text=h.text,p.replaceWith(x),x.append(p),i=i.filter(y=>y!==h)}}}function k3(a){const e=document.createElement("div");e.id="term-tip",e.className="term-tip",e.setAttribute("role","tooltip"),e.hidden=!0,document.body.append(e);let t,n=!1;const i=o=>{t=o,e.replaceChildren();const l=document.createElement("strong");l.textContent=o.dataset.term??"",e.append(l,document.createTextNode(" "+(o.dataset.text??""))),e.hidden=!1;const m=o.getBoundingClientRect(),u=e.offsetWidth,c=e.offsetHeight,h=Math.max(8,Math.min(m.left,window.innerWidth-u-8)),p=m.bottom+6;e.style.left=`${h}px`,e.style.top=`${p+c>window.innerHeight-8?Math.max(8,m.top-c-6):p}px`,o.setAttribute("aria-expanded","true")},s=()=>{t==null||t.setAttribute("aria-expanded","false"),t=void 0,n=!1,e.hidden=!0},r=o=>{var l,m;return((m=(l=o.target)==null?void 0:l.closest)==null?void 0:m.call(l,".term"))??void 0};return a.addEventListener("pointerover",o=>{const l=r(o);l&&o.pointerType==="mouse"&&!n&&i(l)}),a.addEventListener("pointerout",o=>{r(o)&&o.pointerType==="mouse"&&!n&&s()}),a.addEventListener("click",o=>{const l=r(o);if(l){if(n&&t===l)return s();i(l),n=!0}}),a.addEventListener("focusin",o=>{const l=r(o);l&&!n&&i(l)}),a.addEventListener("focusout",o=>{r(o)&&!n&&s()}),a.addEventListener("keydown",o=>{const l=r(o);o.key==="Escape"&&t?s():l&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),l.click())}),a.addEventListener("scroll",s,!0),document.addEventListener("pointerdown",o=>{t&&!r(o)&&!e.contains(o.target)&&s()}),{hide:s}}const ya={leiste:".app > .toolbar",elemente:".palette",struktogramm:".canvas",objektinspektor:".inspector",reiter:".tabs",titel:".caption",neu:"[data-action=new]",oeffnen:"[data-action=open]",speichern:"[data-action=save]",exportieren:"[data-action=export]",rueckgaengig:"[data-action=undo]",textgroesse:"[data-action=zoom]",lernen:"[data-action=learn]",code:"[data-action=code]",simulation:"[data-action=simulate]"};function rn(a){for(const e of a.querySelectorAll('a[href^="#zeige-"]')){const t=e.getAttribute("href").slice(7);if(!(t in ya))continue;const n=document.createElement("span");n.className="ui-pointer",n.tabIndex=0,n.setAttribute("role","button"),n.dataset.target=t,n.append(...e.childNodes),e.replaceWith(n)}}function M3(a){let e,t;const n=()=>{e==null||e.classList.remove("ui-spot"),e=void 0,window.clearTimeout(t)},i=(r,o)=>{n();const l=document.querySelector(ya[r.dataset.target??""]??":not(*)");!l||l.getClientRects().length===0||(e=l,l.classList.add("ui-spot"),o&&(t=window.setTimeout(n,2500)))},s=r=>{var o,l;return((l=(o=r.target)==null?void 0:o.closest)==null?void 0:l.call(o,".ui-pointer"))??void 0};return a.addEventListener("pointerover",r=>{const o=s(r);o&&r.pointerType==="mouse"&&i(o,!1)}),a.addEventListener("pointerout",r=>{s(r)&&r.pointerType==="mouse"&&n()}),a.addEventListener("click",r=>{const o=s(r);o&&i(o,!0)}),a.addEventListener("focusin",r=>{const o=s(r);o&&i(o,!1)}),a.addEventListener("focusout",r=>{s(r)&&n()}),a.addEventListener("keydown",r=>{const o=s(r);o&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),i(o,!0))}),{off:n}}const h1='',Z3=()=>{const a=[];for(const e of de){const t=a.at(-1);t&&t.name===e.section?t.lessons.push(e):a.push({name:e.section,lessons:[e]})}return a};function f(a,e={},...t){const n=document.createElement(a);for(const[i,s]of Object.entries(e))n.setAttribute(i,s);return n.append(...t),n}function Q(a,e,t){const n=f(a,e);return n.innerHTML=t,n}const _3=a=>d(`element_${g[a]}`);function j3(a){return{caption:a,elements:[K(g.anweisung,{textLines:["ø"]})]}}function on(a){const e=a.start?Ze(a.start):void 0;return e?{...e,caption:e.caption||a.title}:j3(a.title)}class P3{constructor(e){b(this,"element");b(this,"tab","lessons");b(this,"returnTo");b(this,"lessonId");b(this,"taskId");b(this,"body");b(this,"tips");b(this,"pointers");this.host=e,this.element=f("aside",{class:"learn","aria-label":d("web_learn_title")}),this.tips=k3(this.element),this.pointers=M3(this.element),K1(Kt(Se()));const t=H.view();t&&(this.tab=["lessons","tasks","reference"].find(n=>n===t.tab)??"lessons",this.lessonId=de.some(n=>n.id===t.lesson)?t.lesson:void 0,this.taskId=t1.some(n=>n.id===t.task)?t.task:void 0),this.render()}render(){this.tips.hide(),this.pointers.off(),K1(Kt(Se()));const e=f("div",{class:"segmented learn-tabs",role:"tablist"});for(const[i,s]of[["lessons",d("web_learn_lessons")],["tasks",d("web_learn_tasks")],["reference",d("web_learn_reference")]]){const r=f("button",{role:"tab","aria-pressed":String(this.tab===i),"data-learn-tab":i},s);r.addEventListener("click",()=>{this.tab===i&&(i==="lessons"&&(this.lessonId=void 0),i==="tasks"&&(this.taskId=void 0)),this.tab=i,this.persist(),this.render()}),e.append(r)}const t=Q("button",{class:"learn-hide",title:d("web_learn_hide"),"aria-label":d("web_learn_hide")},h1);t.addEventListener("click",()=>this.host.collapse());const n=f("div",{class:"learn-head"},e,t);if(this.body=f("div",{class:"learn-body"}),this.element.replaceChildren(n,this.body),this.tab==="lessons"){const i=de.find(s=>s.id===this.lessonId);i?this.renderLesson(i):this.renderLessonList()}else if(this.tab==="tasks"){const i=t1.find(s=>s.id===this.taskId);i?this.renderTask(i):this.renderTaskList()}else{const i=n1.map(s=>`- **${s.term}:** ${s.text}`).join(` + `;const e=i=>this.element.querySelector(i);this.buttons={play:e("[data-sim=play]"),pause:e("[data-sim=pause]"),step:e("[data-sim=step]"),stop:e("[data-sim=stop]")},this.buttons.play.addEventListener("click",()=>this.play()),this.buttons.pause.addEventListener("click",()=>this.pause()),this.buttons.step.addEventListener("click",()=>this.step()),this.buttons.stop.addEventListener("click",()=>this.reset()),this.editButton=e(".sim-edit"),this.editButton.addEventListener("click",()=>this.onEdit());const t=e("[data-sim=highlight]");t.value=this.highlightMode,t.addEventListener("change",()=>{this.highlightMode=t.value,an(nn,this.highlightMode)});const n=e("[data-sim=delay]");n.value=this.delay,n.addEventListener("change",()=>{this.delay=n.value,an(A1,this.delay)}),this.inputSection=e(".sim-input > div"),this.trace=e(".sim-trace"),this.variables=e(".sim-vars"),this.output=e(".sim-output"),this.notice=e(".sim-notice")}update(){if(!this.buttons)return;const{state:e,canStep:t}=this.engine;this.buttons.play.disabled=this.isPlaying||!t,this.buttons.pause.disabled=!this.isPlaying,this.buttons.step.disabled=this.isPlaying||!t,this.notice.textContent=e.notice?et(e.notice):"",this.notice.hidden=!e.notice,this.notice.classList.toggle("error",e.isHalted),this.editButton.hidden=!e.isHalted,this.updateInput(),this.trace.textContent=e.lastTrace??d("simulation_trace_placeholder"),this.trace.classList.toggle("placeholder",!e.lastTrace);const n=[...e.variables.keys()].sort((i,s)=>i.localeCompare(s));if(n.length===0)this.variables.innerHTML=`

${G(d("simulation_variables_placeholder"))}

`;else{const i=document.createElement("table");for(const s of n){const r=i.insertRow();r.insertCell().textContent=s;const o=e.variables.get(s),l=r.insertCell();o.kind==="grid"?l.append(w3(o)):l.textContent=U(o)}this.variables.replaceChildren(i)}e.outputLines.length===0?this.output.innerHTML=`

${G(d("simulation_output_placeholder"))}

`:(this.output.replaceChildren(...e.outputLines.map(i=>{const s=document.createElement("div");return s.textContent=i,s})),this.output.scrollTop=this.output.scrollHeight)}updateInput(){const e=this.engine.state.inputRequest,t=this.inputSection;if(t.parentElement.classList.toggle("active",!!e),!e){t.innerHTML=`

${G(d("simulation_input_placeholder"))}

`;return}let n=t.querySelector("form");if(!n){n=document.createElement("form"),n.innerHTML=`

`;const o=n.querySelector("input");n.addEventListener("submit",l=>{l.preventDefault(),this.submitInput(o)}),t.replaceChildren(n),requestAnimationFrame(()=>o.focus())}n.querySelector(".sim-prompt").textContent=e.prompt;const i=n.querySelector("input");i.inputMode=e.valueType==="string"||e.valueType==="boolean"?"text":"decimal";const s=this.engine.state.inputErrorNotice,r=n.querySelector(".sim-input-error");r.textContent=s?et(s):"",r.hidden=!s}}function w3(a){const e=document.createElement("table");e.className="sim-grid";for(const t of a.value){const n=e.insertRow();for(const i of t){const s=n.insertCell();s.textContent=String(i),i===!0&&(s.className="sim-grid-true")}}return e}const S3="code, pre, a, button, h1, h2, h3, h4, strong, .term, .ui-pointer";function sn(a,e){var s;const t=[...a.querySelectorAll(".learn-text")],n=new Set;for(const r of t.flatMap(o=>[...o.querySelectorAll("strong")])){const o=Xt(e),l=o==null?void 0:o.exec(r.textContent??""),m=l?Jt(e,l[0]):void 0;m&&n.add(m)}let i=e.filter(r=>!n.has(r));for(const r of t){const o=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();){const m=o.currentNode;(s=m.parentElement)!=null&&s.closest(S3)||l.push(m)}for(let m of l)for(;;){const u=Xt(i),c=u==null?void 0:u.exec(m.data),h=c?Jt(i,c[0]):void 0;if(!c||!h)break;const p=m.splitText(c.index);m=p.splitText(c[0].length);const x=document.createElement("span");x.className="term",x.tabIndex=0,x.setAttribute("role","button"),x.setAttribute("aria-describedby","term-tip"),x.dataset.term=h.term,x.dataset.text=h.text,p.replaceWith(x),x.append(p),i=i.filter(f=>f!==h)}}}function k3(a){const e=document.createElement("div");e.id="term-tip",e.className="term-tip",e.setAttribute("role","tooltip"),e.hidden=!0,document.body.append(e);let t,n=!1;const i=o=>{t=o,e.replaceChildren();const l=document.createElement("strong");l.textContent=o.dataset.term??"",e.append(l,document.createTextNode(" "+(o.dataset.text??""))),e.hidden=!1;const m=o.getBoundingClientRect(),u=e.offsetWidth,c=e.offsetHeight,h=Math.max(8,Math.min(m.left,window.innerWidth-u-8)),p=m.bottom+6;e.style.left=`${h}px`,e.style.top=`${p+c>window.innerHeight-8?Math.max(8,m.top-c-6):p}px`,o.setAttribute("aria-expanded","true")},s=()=>{t==null||t.setAttribute("aria-expanded","false"),t=void 0,n=!1,e.hidden=!0},r=o=>{var l,m;return((m=(l=o.target)==null?void 0:l.closest)==null?void 0:m.call(l,".term"))??void 0};return a.addEventListener("pointerover",o=>{const l=r(o);l&&o.pointerType==="mouse"&&!n&&i(l)}),a.addEventListener("pointerout",o=>{r(o)&&o.pointerType==="mouse"&&!n&&s()}),a.addEventListener("click",o=>{const l=r(o);if(l){if(n&&t===l)return s();i(l),n=!0}}),a.addEventListener("focusin",o=>{const l=r(o);l&&!n&&i(l)}),a.addEventListener("focusout",o=>{r(o)&&!n&&s()}),a.addEventListener("keydown",o=>{const l=r(o);o.key==="Escape"&&t?s():l&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),l.click())}),a.addEventListener("scroll",s,!0),document.addEventListener("pointerdown",o=>{t&&!r(o)&&!e.contains(o.target)&&s()}),{hide:s}}const ya={leiste:".app > .toolbar",elemente:".palette",struktogramm:".canvas",objektinspektor:".inspector",reiter:".tabs",titel:".caption",neu:"[data-action=new]",oeffnen:"[data-action=open]",speichern:"[data-action=save]",exportieren:"[data-action=export]",rueckgaengig:"[data-action=undo]",textgroesse:"[data-action=zoom]",lernen:".learn .learn-hide",code:"[data-action=code]",simulation:"[data-action=simulate]"};function rn(a){for(const e of a.querySelectorAll('a[href^="#zeige-"]')){const t=e.getAttribute("href").slice(7);if(!(t in ya))continue;const n=document.createElement("span");n.className="ui-pointer",n.tabIndex=0,n.setAttribute("role","button"),n.dataset.target=t,n.append(...e.childNodes),e.replaceWith(n)}}function M3(a){let e,t;const n=()=>{e==null||e.classList.remove("ui-spot"),e=void 0,window.clearTimeout(t)},i=(r,o)=>{n();const l=document.querySelector(ya[r.dataset.target??""]??":not(*)");!l||l.getClientRects().length===0||(e=l,l.classList.add("ui-spot"),o&&(t=window.setTimeout(n,2500)))},s=r=>{var o,l;return((l=(o=r.target)==null?void 0:o.closest)==null?void 0:l.call(o,".ui-pointer"))??void 0};return a.addEventListener("pointerover",r=>{const o=s(r);o&&r.pointerType==="mouse"&&i(o,!1)}),a.addEventListener("pointerout",r=>{s(r)&&r.pointerType==="mouse"&&n()}),a.addEventListener("click",r=>{const o=s(r);o&&i(o,!0)}),a.addEventListener("focusin",r=>{const o=s(r);o&&i(o,!1)}),a.addEventListener("focusout",r=>{s(r)&&n()}),a.addEventListener("keydown",r=>{const o=s(r);o&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),i(o,!0))}),{off:n}}const h1='',Z3=()=>{const a=[];for(const e of de){const t=a.at(-1);t&&t.name===e.section?t.lessons.push(e):a.push({name:e.section,lessons:[e]})}return a};function b(a,e={},...t){const n=document.createElement(a);for(const[i,s]of Object.entries(e))n.setAttribute(i,s);return n.append(...t),n}function Q(a,e,t){const n=b(a,e);return n.innerHTML=t,n}const _3=a=>d(`element_${g[a]}`);function j3(a){return{caption:a,elements:[K(g.anweisung,{textLines:["ø"]})]}}function on(a){const e=a.start?Ze(a.start):void 0;return e?{...e,caption:e.caption||a.title}:j3(a.title)}class P3{constructor(e){y(this,"element");y(this,"tab","lessons");y(this,"returnTo");y(this,"lessonId");y(this,"taskId");y(this,"body");y(this,"tips");y(this,"pointers");this.host=e,this.element=b("aside",{class:"learn","aria-label":d("web_learn_title")}),this.tips=k3(this.element),this.pointers=M3(this.element),K1(Kt(Se()));const t=H.view();t&&(this.tab=["lessons","tasks","reference"].find(n=>n===t.tab)??"lessons",this.lessonId=de.some(n=>n.id===t.lesson)?t.lesson:void 0,this.taskId=t1.some(n=>n.id===t.task)?t.task:void 0),this.render()}render(){this.tips.hide(),this.pointers.off(),K1(Kt(Se()));const e=b("div",{class:"segmented learn-tabs",role:"tablist"});for(const[i,s]of[["lessons",d("web_learn_lessons")],["tasks",d("web_learn_tasks")],["reference",d("web_learn_reference")]]){const r=b("button",{role:"tab","aria-pressed":String(this.tab===i),"data-learn-tab":i},s);r.addEventListener("click",()=>{this.tab===i&&(i==="lessons"&&(this.lessonId=void 0),i==="tasks"&&(this.taskId=void 0)),this.tab=i,this.persist(),this.render()}),e.append(r)}const t=Q("button",{class:"learn-hide",title:d("web_learn_hide"),"aria-label":d("web_learn_hide")},h1);t.addEventListener("click",()=>this.host.collapse());const n=b("div",{class:"learn-head"},e,t);if(this.body=b("div",{class:"learn-body"}),this.element.replaceChildren(n,this.body),this.tab==="lessons"){const i=de.find(s=>s.id===this.lessonId);i?this.renderLesson(i):this.renderLessonList()}else if(this.tab==="tasks"){const i=t1.find(s=>s.id===this.taskId);i?this.renderTask(i):this.renderTaskList()}else{const i=n1.map(s=>`- **${s.term}:** ${s.text}`).join(` `);this.body.append(Q("div",{class:"learn-text learn-reference"},ze(`${ga} ### ${d("web_learn_terms")} -${i}`)))}}persist(){H.setView({tab:this.tab,lesson:this.lessonId,task:this.taskId})}openLesson(e){this.tab="lessons",this.lessonId=e,this.returnTo=void 0,this.persist(),this.render(),this.body.scrollTop=0}renderLessonList(){this.body.append(f("p",{class:"hint"},d("web_learn_intro")));for(const e of Z3()){this.body.append(f("h3",{class:"learn-section"},e.name));const t=f("ol",{class:"learn-list"});for(const n of e.lessons){const i=H.lesson(n.id),s=i.done?"✓":i.step>0?d("web_learn_step_of_fmt",i.step+1,n.steps.length):"",r=f("button",{class:"learn-item"+(i.done?" done":""),"data-lesson":n.id},f("span",{class:"learn-num"},String(n.number)),f("span",{class:"learn-item-text"},f("strong",{},n.title),f("small",{},n.summary)),f("span",{class:"learn-status"},s));r.addEventListener("click",()=>this.openLesson(n.id)),t.append(f("li",{},r))}this.body.append(t)}this.body.append(this.renderTeacherBox())}renderLesson(e){var c;const t=H.lesson(e.id),n=Math.min(t.step,e.steps.length-1),i=e.steps[n],s=f("button",{class:"learn-back"},`← ${d("web_learn_all_lessons")}`);s.addEventListener("click",()=>this.openLesson(void 0));const r=f("nav",{class:"learn-progress","aria-label":d("web_learn_step_of_fmt",n+1,e.steps.length)});r.append(...e.steps.map((h,p)=>{const x=d("web_learn_step_fmt",p+1,h.title),y=f("button",{class:pthis.goToStep(e,p)),y})),this.body.append(s,f("p",{class:"learn-kicker"},`${d("web_learn_lesson_fmt",e.number)} · ${e.section}`),f("h2",{class:"learn-title"},e.title),r,f("h3",{class:"learn-step-title"},`${n+1}. ${i.title}`));const o=((c=this.returnTo)==null?void 0:c.lesson)===e.id&&this.returnTo.step!==n?this.returnTo:void 0,l=()=>{const h=f("button",{class:"learn-return"},`↩ ${d("web_learn_back_to_checklist")}`);return h.addEventListener("click",()=>{this.returnTo=void 0,this.goToStep(e,o.step),this.body.scrollTop=o.scroll}),h};o&&this.body.append(l()),i.blocks.forEach((h,p)=>this.body.append(this.renderBlock(h,`${n}-${p}`,e))),rn(this.body),sn(this.body,n1);const m=f("div",{class:"learn-nav"}),u=f("button",{},`← ${d("web_learn_back")}`);if(u.disabled=n===0,u.addEventListener("click",()=>this.goToStep(e,n-1)),m.append(u),nthis.goToStep(e,n+1)),m.append(h)}else{const h=f("button",{class:"primary"},t.done?`✓ ${d("web_learn_done")}`:d("web_learn_finish"));h.addEventListener("click",()=>{H.updateLesson(e.id,{done:!0});const p=de.find(x=>x.number===e.number+1);this.openLesson(p==null?void 0:p.id)}),m.append(h)}this.body.append(m),o&&this.body.append(l())}goToStep(e,t){H.updateLesson(e.id,{step:t}),this.render(),this.body.scrollTop=0}renderTaskList(){this.body.append(f("p",{class:"hint"},d("web_learn_tasks_intro")));const e=f("ul",{class:"learn-list"});for(const t of t1){const n=this.taskExercises(t).every(r=>H.exercise(r.id).done),i=de.find(r=>r.number===t.after),s=f("button",{class:"learn-item"+(n?" done":""),"data-task":t.id},f("span",{class:"learn-num","aria-label":d("web_learn_level_fmt",t.level)},"★".repeat(t.level)),f("span",{class:"learn-item-text"},f("strong",{},t.title),f("small",{},i?d("web_learn_after_fmt",i.number,i.title):"")),f("span",{class:"learn-status"},n?"✓":""));s.addEventListener("click",()=>{this.taskId=t.id,this.persist(),this.render(),this.body.scrollTop=0}),e.append(f("li",{},s))}this.body.append(e,this.renderTeacherBox())}renderTeacherBox(){const e=f("details",{class:"learn-teacher"},f("summary",{},d("web_learn_teacher")));if(en()){e.setAttribute("open","");const s=f("button",{},d("web_learn_teacher_off"));return s.addEventListener("click",()=>{y3(),this.render()}),e.append(f("p",{},d("web_learn_teacher_on")),s),e}const t=f("input",{type:"password",autocomplete:"off","aria-label":d("web_learn_teacher_code"),placeholder:d("web_learn_teacher_code")}),n=f("p",{class:"learn-result",role:"status"}),i=f("form",{class:"group"},t,f("button",{type:"submit"},d("web_learn_teacher_unlock")));return i.addEventListener("submit",async s=>{s.preventDefault(),await f3(t.value)?this.render():(n.className="learn-result info",n.textContent=d("web_learn_teacher_wrong"))}),e.append(f("p",{class:"hint"},d("web_learn_teacher_intro")),i,n),e}taskExercises(e){return e.blocks.flatMap(t=>t.kind==="exercise"?[t.exercise]:[])}renderTask(e){const t=f("button",{class:"learn-back"},`← ${d("web_learn_all_tasks")}`);t.addEventListener("click",()=>{this.taskId=void 0,this.persist(),this.render()});const n=de.find(i=>i.number===e.after);if(this.body.append(t,f("h2",{class:"learn-title"},e.title)),n){const i=f("button",{class:"link-button"},d("web_learn_after_fmt",n.number,n.title));i.addEventListener("click",()=>this.openLesson(n.id)),this.body.append(f("p",{class:"learn-kicker"},i))}e.blocks.forEach((i,s)=>this.body.append(this.renderBlock(i,`task-${s}`))),rn(this.body),sn(this.body,n1)}renderBlock(e,t,n){switch(e.kind){case"markdown":return Q("div",{class:"learn-text"},ze(e.text));case"diagram":return this.renderDiagram(e.file,e.caption);case"exercise":return this.renderExercise(e.exercise);case"checklist":return this.renderChecklist(e.items,t,n);case"quiz":return this.renderQuiz(e.questions,t,n);case"brag":return this.renderBrag(e.text);case"images":return this.renderImages(e.files,e.caption);case"graphic":return this.renderGraphic(e.file,e.caption)}}renderBrag(e){const t=f("aside",{class:"learn-brag"});t.append(f("img",{src:x3,alt:"",width:"48",height:"48"}));const n=f("div",{},f("p",{class:"learn-brag-title"},d("web_learn_brag")));return n.append(Q("div",{class:"learn-text"},ze(e))),t.append(n),t}renderImages(e,t){const n=f("figure",{class:"learn-figure"}),i=f("div",{class:"learn-images"});for(const s of e){const r=$t(s);r&&i.append(f("img",{src:r,alt:"",loading:"lazy"}))}return n.append(i),t&&n.append(Q("figcaption",{},X(t))),n}renderGraphic(e,t){const n=f("figure",{class:"learn-figure"}),i=$t(e);return i&&n.append(f("img",{class:"learn-graphic",src:i,alt:"",loading:"lazy"})),t&&n.append(Q("figcaption",{},X(t))),n}renderDiagram(e,t){const n=Ze(e),i=f("figure",{class:"learn-figure"});if(!n)return i;const s=this.host.preview(n);s&&i.append(f("div",{class:"learn-preview",dir:"ltr"},s)),t&&i.append(Q("figcaption",{},X(t)));const r=f("button",{},d("web_learn_open_in_editor"));return r.addEventListener("click",()=>this.host.openDiagram(n,e)),i.append(r),i}renderExercise(e){const t=f("section",{class:"learn-exercise","data-exercise":e.id}),n=()=>H.exercise(e.id),i=f("span",{class:"learn-badge"},`✓ ${d("web_learn_solved")}`);i.hidden=!n().done,t.append(f("h4",{},`${d("web_learn_exercise")}: ${e.title}`,i),Q("div",{class:"learn-text"},ze(e.task)));const s=f("div",{class:"learn-result",role:"status"}),r=f("div",{class:"learn-hints"}),o=f("div",{class:"group"}),l=f("button",{class:"primary"},d("web_learn_open_exercise"));l.addEventListener("click",()=>{const c=n().xml;let h=on(e);if(c)try{h=rt(c)}catch{}this.host.openExercise(e,h)});const m=f("button",{},d("web_learn_check"));if(m.addEventListener("click",()=>{const c=this.host.exerciseDocument(e.id);if(!c){s.className="learn-result info",s.textContent=d("web_learn_open_first");return}if(c.elements.every(nt)){s.className="learn-result info",s.textContent=d("web_learn_empty");return}this.host.stopSimulation();const h=bs(c,e.tests,this.host.subprogramsFor(e.id)),p=fs(c),x=e.requires.map(I=>I==="forZaehlSchleife"?"forSchleife":I).filter(I=>I in g&&!p.has(g[I])),y=h.every(I=>I.passed)&&x.length===0;this.showResult(s,h,x,y),y&&(H.updateExercise(e.id,{done:!0}),i.hidden=!1)}),o.append(l,m),e.hints.length>0){const c=f("button",{},d("web_learn_hint"));c.addEventListener("click",()=>{const h=r.children.length;if(h>=e.hints.length)return;const p=e.hints.length>1?`**${d("web_learn_hint_fmt",h+1,e.hints.length)}:** `:"";r.append(Q("aside",{class:"lesson-note"},ze(p+e.hints[h]))),c.textContent=d("web_learn_hint_more"),c.toggleAttribute("disabled",h+1>=e.hints.length)}),o.append(c)}const u=f("button",{class:"danger-text"},d("web_learn_reset"));if(u.addEventListener("click",()=>{if(u.dataset.confirm!=="1"){u.dataset.confirm="1",u.textContent=d("web_learn_reset_confirm"),setTimeout(()=>{u.dataset.confirm="",u.textContent=d("web_learn_reset")},4e3);return}H.resetExercise(e.id),this.host.resetExercise(e.id,on(e)),i.hidden=!0,s.replaceChildren(),s.className="learn-result",u.dataset.confirm="",u.textContent=d("web_learn_reset")}),o.append(u),t.append(o,r,s),en()&&e.solution){const c=Ze(e.solution);if(c){const h=f("details",{class:"learn-solution"},f("summary",{},d("web_learn_solution")));h.addEventListener("toggle",()=>{if(!h.open||h.querySelector(".learn-preview"))return;const p=this.host.preview(c);p&&h.append(f("div",{class:"learn-preview",dir:"ltr"},p));const x=f("button",{},d("web_learn_open_in_editor"));x.addEventListener("click",()=>{this.host.openDiagram(c,e.solution);for(const y of e.subprograms){const I=Ze(y);I&&this.host.openDiagram(I,y)}});for(const y of e.subprograms){const I=Ze(y),v=I&&this.host.preview(I);v&&h.append(f("div",{class:"learn-preview",dir:"ltr"},v))}h.append(x)}),t.append(h)}}return t}showResult(e,t,n,i){e.className="learn-result "+(i?"ok":"fail"),e.replaceChildren(f("p",{class:"learn-result-head"},i?`🎉 ${d("web_learn_passed")}`:d("web_learn_failed")));for(const r of n)e.append(f("p",{},`✗ ${d("web_learn_missing_fmt",_3(g[r]))}`));const s=f("ul",{class:"learn-tests",dir:"auto"});for(const r of t){const o=r.test.inputs.length?d("web_learn_input_fmt",r.test.inputs.join(", ")):d("web_learn_no_input"),l=[`${r.passed?"✓":"✗"} ${o}`],m=f("div",{class:"learn-test-detail"});m.append(f("span",{},`${d("web_learn_expected")}: `,f("code",{},r.test.expected.join(" | ")||"–")),f("span",{},`${d("web_learn_actual")}: `,f("code",{},r.result.outputs.join(" | ")||"–"))),r.result.error&&m.append(f("span",{class:"learn-error"},et(r.result.error))),r.result.missingInput&&m.append(f("span",{class:"learn-error"},d("web_learn_missing_input"))),r.result.tooManySteps&&m.append(f("span",{class:"learn-error"},d("web_learn_too_many_steps"))),!r.passed&&r.result.unusedInputs&&m.append(f("span",{class:"learn-error"},d("web_learn_unused_input"))),s.append(f("li",{class:r.passed?"ok":"fail"},...l,m))}e.append(s)}renderChecklist(e,t,n){const i=f("ul",{class:"learn-checklist"});return e.forEach((s,r)=>{var c;const o=`${t}-${r}`,l=f("input",{type:"checkbox"});l.checked=!!(n&&((c=H.lesson(n.id).checks)!=null&&c[o])),l.addEventListener("change",()=>{if(!n)return;const h={...H.lesson(n.id).checks??{},[o]:l.checked};H.updateLesson(n.id,{checks:h})});const m=f("label",{},l);m.insertAdjacentHTML("beforeend"," "+X(s.text));const u=f("li",{},m);if(n&&s.step!==void 0){const h=s.step,p=d("web_learn_step_fmt",h+1,n.steps[h].title),x=f("button",{class:"link-button learn-check-link",title:p,"aria-label":`${d("web_learn_review")}: ${p}`},d("web_learn_review"));x.addEventListener("click",()=>{this.returnTo={lesson:n.id,step:H.lesson(n.id).step,scroll:this.body.scrollTop},this.goToStep(n,h)}),u.append(x)}i.append(u)}),i}renderQuiz(e,t,n){const i=f("div",{class:"learn-quiz"}),s=f("p",{class:"learn-score",role:"status"}),r=()=>n?H.lesson(n.id).quiz??{}:{},o=()=>{const l=r(),m=(p,x)=>p.pairs?p.pairs.every((y,I)=>l[`${t}-${x}-${I}`]!==void 0):l[`${t}-${x}`]!==void 0,u=(p,x)=>{var y;return p.pairs?p.pairs.every((I,v)=>ln(p)[l[`${t}-${x}-${v}`]]===p.pairs[v].right):(y=p.options[l[`${t}-${x}`]])==null?void 0:y.correct},c=e.filter(m).length,h=e.filter(u).length;s.textContent=c===e.length?d("web_learn_score_fmt",h,e.length):""};return e.forEach((l,m)=>{const u=`${t}-${m}`,c=f("fieldset",{},Q("legend",{},X(l.question))),h=Q("p",{class:"learn-explanation"},X(l.explanation??""));if(l.pairs){c.append(this.renderMatch(l,u,r,n,h,o),h),i.append(c);return}const p=x=>{c.querySelectorAll("button").forEach((y,I)=>{y.classList.toggle("right",x!==void 0&&l.options[I].correct),y.classList.toggle("wrong",x===I&&!l.options[I].correct),y.setAttribute("aria-pressed",String(x===I))}),h.hidden=x===void 0||!l.explanation};l.options.forEach((x,y)=>{const I=Q("button",{class:"learn-option"},X(x.text));I.addEventListener("click",()=>{n&&H.updateLesson(n.id,{quiz:{...r(),[u]:y}}),p(y),o()}),c.append(I)}),c.append(h),p(r()[u]),i.append(c)}),i.append(s),o(),i}renderMatch(e,t,n,i,s,r){const o=e.pairs,l=ln(e),m=f("div",{class:"learn-match"});let u={};const c=()=>i?n():u,h=I=>i?H.updateLesson(i.id,{quiz:I}):u=I,p=I=>c()[`${t}-${I}`],x=o.map(I=>{const v=f("select",{class:"learn-match-select"});v.append(f("option",{value:""},"–")),l.forEach((j,_)=>v.append(f("option",{value:String(_)},j)));const w=Q("label",{class:"learn-match-left"},X(I.left));return w.append(v),m.append(w),v}),y=()=>{const I=o.every((v,w)=>p(w)!==void 0);x.forEach((v,w)=>{const j=p(w);v.value=j===void 0?"":String(j),v.classList.toggle("right",I&&l[j]===o[w].right),v.classList.toggle("wrong",I&&l[j]!==o[w].right)}),s.hidden=!I||!e.explanation};return x.forEach((I,v)=>I.addEventListener("change",()=>{const w={...c()};I.value===""?delete w[`${t}-${v}`]:w[`${t}-${v}`]=Number(I.value),h(w),y(),r()})),y(),m}}function ln(a){return(a.pairs??[]).map(e=>e.right).sort((e,t)=>e.localeCompare(t,"de"))}const za="visustruct.live.target";function C3(){try{const a=localStorage.getItem(za);return a==="javascript"||a==="python"?a:"java"}catch{return"java"}}const he=a=>a.replace(/&/g,"&").replace(//g,">");function A3(a){let e="",t=a;for(;;){const n=t.indexOf(z1);if(n<0)break;const i=t.indexOf(sa,n);if(i<0)break;e+=he(t.slice(0,n))+`${he(t.slice(n+1,i))}`,t=t.slice(i+1)}return e+he(t)}const T3=(a,e)=>a.length===e.length&&a.every((t,n)=>t===e[n]);function D3(a,e){let t;for(const n of a)en.to||(!t||n.to-n.fromt.path.length)&&(t=n);return t}class W3{constructor(e,t){b(this,"element");b(this,"view");b(this,"spans",[]);b(this,"highlighted");b(this,"html","");b(this,"target",C3());b(this,"last");this.onHide=e,this.onSelect=t,this.element=document.createElement("aside"),this.element.className="livecode",this.build()}build(){this.element.innerHTML=` +${i}`)))}}persist(){H.setView({tab:this.tab,lesson:this.lessonId,task:this.taskId})}openLesson(e){this.tab="lessons",this.lessonId=e,this.returnTo=void 0,this.persist(),this.render(),this.body.scrollTop=0}renderLessonList(){this.body.append(b("p",{class:"hint"},d("web_learn_intro")));for(const e of Z3()){this.body.append(b("h3",{class:"learn-section"},e.name));const t=b("ol",{class:"learn-list"});for(const n of e.lessons){const i=H.lesson(n.id),s=i.done?"✓":i.step>0?d("web_learn_step_of_fmt",i.step+1,n.steps.length):"",r=b("button",{class:"learn-item"+(i.done?" done":""),"data-lesson":n.id},b("span",{class:"learn-num"},String(n.number)),b("span",{class:"learn-item-text"},b("strong",{},n.title),b("small",{},n.summary)),b("span",{class:"learn-status"},s));r.addEventListener("click",()=>this.openLesson(n.id)),t.append(b("li",{},r))}this.body.append(t)}this.body.append(this.renderTeacherBox())}renderLesson(e){var c;const t=H.lesson(e.id),n=Math.min(t.step,e.steps.length-1),i=e.steps[n],s=b("button",{class:"learn-back"},`← ${d("web_learn_all_lessons")}`);s.addEventListener("click",()=>this.openLesson(void 0));const r=b("nav",{class:"learn-progress","aria-label":d("web_learn_step_of_fmt",n+1,e.steps.length)});r.append(...e.steps.map((h,p)=>{const x=d("web_learn_step_fmt",p+1,h.title),f=b("button",{class:pthis.goToStep(e,p)),f})),this.body.append(s,b("p",{class:"learn-kicker"},`${d("web_learn_lesson_fmt",e.number)} · ${e.section}`),b("h2",{class:"learn-title"},e.title),r,b("h3",{class:"learn-step-title"},`${n+1}. ${i.title}`));const o=((c=this.returnTo)==null?void 0:c.lesson)===e.id&&this.returnTo.step!==n?this.returnTo:void 0,l=()=>{const h=b("button",{class:"learn-return"},`↩ ${d("web_learn_back_to_checklist")}`);return h.addEventListener("click",()=>{this.returnTo=void 0,this.goToStep(e,o.step),this.body.scrollTop=o.scroll}),h};o&&this.body.append(l()),i.blocks.forEach((h,p)=>this.body.append(this.renderBlock(h,`${n}-${p}`,e))),rn(this.body),sn(this.body,n1);const m=b("div",{class:"learn-nav"}),u=b("button",{},`← ${d("web_learn_back")}`);if(u.disabled=n===0,u.addEventListener("click",()=>this.goToStep(e,n-1)),m.append(u),nthis.goToStep(e,n+1)),m.append(h)}else{const h=b("button",{class:"primary"},t.done?`✓ ${d("web_learn_done")}`:d("web_learn_finish"));h.addEventListener("click",()=>{H.updateLesson(e.id,{done:!0});const p=de.find(x=>x.number===e.number+1);this.openLesson(p==null?void 0:p.id)}),m.append(h)}this.body.append(m),o&&this.body.append(l())}goToStep(e,t){H.updateLesson(e.id,{step:t}),this.render(),this.body.scrollTop=0}renderTaskList(){this.body.append(b("p",{class:"hint"},d("web_learn_tasks_intro")));const e=b("ul",{class:"learn-list"});for(const t of t1){const n=this.taskExercises(t).every(r=>H.exercise(r.id).done),i=de.find(r=>r.number===t.after),s=b("button",{class:"learn-item"+(n?" done":""),"data-task":t.id},b("span",{class:"learn-num","aria-label":d("web_learn_level_fmt",t.level)},"★".repeat(t.level)),b("span",{class:"learn-item-text"},b("strong",{},t.title),b("small",{},i?d("web_learn_after_fmt",i.number,i.title):"")),b("span",{class:"learn-status"},n?"✓":""));s.addEventListener("click",()=>{this.taskId=t.id,this.persist(),this.render(),this.body.scrollTop=0}),e.append(b("li",{},s))}this.body.append(e,this.renderTeacherBox())}renderTeacherBox(){const e=b("details",{class:"learn-teacher"},b("summary",{},d("web_learn_teacher")));if(en()){e.setAttribute("open","");const s=b("button",{},d("web_learn_teacher_off"));return s.addEventListener("click",()=>{y3(),this.render()}),e.append(b("p",{},d("web_learn_teacher_on")),s),e}const t=b("input",{type:"password",autocomplete:"off","aria-label":d("web_learn_teacher_code"),placeholder:d("web_learn_teacher_code")}),n=b("p",{class:"learn-result",role:"status"}),i=b("form",{class:"group"},t,b("button",{type:"submit"},d("web_learn_teacher_unlock")));return i.addEventListener("submit",async s=>{s.preventDefault(),await f3(t.value)?this.render():(n.className="learn-result info",n.textContent=d("web_learn_teacher_wrong"))}),e.append(b("p",{class:"hint"},d("web_learn_teacher_intro")),i,n),e}taskExercises(e){return e.blocks.flatMap(t=>t.kind==="exercise"?[t.exercise]:[])}renderTask(e){const t=b("button",{class:"learn-back"},`← ${d("web_learn_all_tasks")}`);t.addEventListener("click",()=>{this.taskId=void 0,this.persist(),this.render()});const n=de.find(i=>i.number===e.after);if(this.body.append(t,b("h2",{class:"learn-title"},e.title)),n){const i=b("button",{class:"link-button"},d("web_learn_after_fmt",n.number,n.title));i.addEventListener("click",()=>this.openLesson(n.id)),this.body.append(b("p",{class:"learn-kicker"},i))}e.blocks.forEach((i,s)=>this.body.append(this.renderBlock(i,`task-${s}`))),rn(this.body),sn(this.body,n1)}renderBlock(e,t,n){switch(e.kind){case"markdown":return Q("div",{class:"learn-text"},ze(e.text));case"diagram":return this.renderDiagram(e.file,e.caption);case"exercise":return this.renderExercise(e.exercise);case"checklist":return this.renderChecklist(e.items,t,n);case"quiz":return this.renderQuiz(e.questions,t,n);case"brag":return this.renderBrag(e.text);case"images":return this.renderImages(e.files,e.caption);case"graphic":return this.renderGraphic(e.file,e.caption)}}renderBrag(e){const t=b("aside",{class:"learn-brag"});t.append(b("img",{src:x3,alt:"",width:"48",height:"48"}));const n=b("div",{},b("p",{class:"learn-brag-title"},d("web_learn_brag")));return n.append(Q("div",{class:"learn-text"},ze(e))),t.append(n),t}renderImages(e,t){const n=b("figure",{class:"learn-figure"}),i=b("div",{class:"learn-images"});for(const s of e){const r=$t(s);r&&i.append(b("img",{src:r,alt:"",loading:"lazy"}))}return n.append(i),t&&n.append(Q("figcaption",{},X(t))),n}renderGraphic(e,t){const n=b("figure",{class:"learn-figure"}),i=$t(e);return i&&n.append(b("img",{class:"learn-graphic",src:i,alt:"",loading:"lazy"})),t&&n.append(Q("figcaption",{},X(t))),n}renderDiagram(e,t){const n=Ze(e),i=b("figure",{class:"learn-figure"});if(!n)return i;const s=this.host.preview(n);s&&i.append(b("div",{class:"learn-preview",dir:"ltr"},s)),t&&i.append(Q("figcaption",{},X(t)));const r=b("button",{},d("web_learn_open_in_editor"));return r.addEventListener("click",()=>this.host.openDiagram(n,e)),i.append(r),i}renderExercise(e){const t=b("section",{class:"learn-exercise","data-exercise":e.id}),n=()=>H.exercise(e.id),i=b("span",{class:"learn-badge"},`✓ ${d("web_learn_solved")}`);i.hidden=!n().done,t.append(b("h4",{},`${d("web_learn_exercise")}: ${e.title}`,i),Q("div",{class:"learn-text"},ze(e.task)));const s=b("div",{class:"learn-result",role:"status"}),r=b("div",{class:"learn-hints"}),o=b("div",{class:"group"}),l=b("button",{class:"primary"},d("web_learn_open_exercise"));l.addEventListener("click",()=>{const c=n().xml;let h=on(e);if(c)try{h=rt(c)}catch{}this.host.openExercise(e,h)});const m=b("button",{},d("web_learn_check"));if(m.addEventListener("click",()=>{const c=this.host.exerciseDocument(e.id);if(!c){s.className="learn-result info",s.textContent=d("web_learn_open_first");return}if(c.elements.every(nt)){s.className="learn-result info",s.textContent=d("web_learn_empty");return}this.host.stopSimulation();const h=bs(c,e.tests,this.host.subprogramsFor(e.id)),p=fs(c),x=e.requires.map(I=>I==="forZaehlSchleife"?"forSchleife":I).filter(I=>I in g&&!p.has(g[I])),f=h.every(I=>I.passed)&&x.length===0;this.showResult(s,h,x,f),f&&(H.updateExercise(e.id,{done:!0}),i.hidden=!1)}),o.append(l,m),e.hints.length>0){const c=b("button",{},d("web_learn_hint"));c.addEventListener("click",()=>{const h=r.children.length;if(h>=e.hints.length)return;const p=e.hints.length>1?`**${d("web_learn_hint_fmt",h+1,e.hints.length)}:** `:"";r.append(Q("aside",{class:"lesson-note"},ze(p+e.hints[h]))),c.textContent=d("web_learn_hint_more"),c.toggleAttribute("disabled",h+1>=e.hints.length)}),o.append(c)}const u=b("button",{class:"danger-text"},d("web_learn_reset"));if(u.addEventListener("click",()=>{if(u.dataset.confirm!=="1"){u.dataset.confirm="1",u.textContent=d("web_learn_reset_confirm"),setTimeout(()=>{u.dataset.confirm="",u.textContent=d("web_learn_reset")},4e3);return}H.resetExercise(e.id),this.host.resetExercise(e.id,on(e)),i.hidden=!0,s.replaceChildren(),s.className="learn-result",u.dataset.confirm="",u.textContent=d("web_learn_reset")}),o.append(u),t.append(o,r,s),en()&&e.solution){const c=Ze(e.solution);if(c){const h=b("details",{class:"learn-solution"},b("summary",{},d("web_learn_solution")));h.addEventListener("toggle",()=>{if(!h.open||h.querySelector(".learn-preview"))return;const p=this.host.preview(c);p&&h.append(b("div",{class:"learn-preview",dir:"ltr"},p));const x=b("button",{},d("web_learn_open_in_editor"));x.addEventListener("click",()=>{this.host.openDiagram(c,e.solution);for(const f of e.subprograms){const I=Ze(f);I&&this.host.openDiagram(I,f)}});for(const f of e.subprograms){const I=Ze(f),v=I&&this.host.preview(I);v&&h.append(b("div",{class:"learn-preview",dir:"ltr"},v))}h.append(x)}),t.append(h)}}return t}showResult(e,t,n,i){e.className="learn-result "+(i?"ok":"fail"),e.replaceChildren(b("p",{class:"learn-result-head"},i?`🎉 ${d("web_learn_passed")}`:d("web_learn_failed")));for(const r of n)e.append(b("p",{},`✗ ${d("web_learn_missing_fmt",_3(g[r]))}`));const s=b("ul",{class:"learn-tests",dir:"auto"});for(const r of t){const o=r.test.inputs.length?d("web_learn_input_fmt",r.test.inputs.join(", ")):d("web_learn_no_input"),l=[`${r.passed?"✓":"✗"} ${o}`],m=b("div",{class:"learn-test-detail"});m.append(b("span",{},`${d("web_learn_expected")}: `,b("code",{},r.test.expected.join(" | ")||"–")),b("span",{},`${d("web_learn_actual")}: `,b("code",{},r.result.outputs.join(" | ")||"–"))),r.result.error&&m.append(b("span",{class:"learn-error"},et(r.result.error))),r.result.missingInput&&m.append(b("span",{class:"learn-error"},d("web_learn_missing_input"))),r.result.tooManySteps&&m.append(b("span",{class:"learn-error"},d("web_learn_too_many_steps"))),!r.passed&&r.result.unusedInputs&&m.append(b("span",{class:"learn-error"},d("web_learn_unused_input"))),s.append(b("li",{class:r.passed?"ok":"fail"},...l,m))}e.append(s)}renderChecklist(e,t,n){const i=b("ul",{class:"learn-checklist"});return e.forEach((s,r)=>{var c;const o=`${t}-${r}`,l=b("input",{type:"checkbox"});l.checked=!!(n&&((c=H.lesson(n.id).checks)!=null&&c[o])),l.addEventListener("change",()=>{if(!n)return;const h={...H.lesson(n.id).checks??{},[o]:l.checked};H.updateLesson(n.id,{checks:h})});const m=b("label",{},l);m.insertAdjacentHTML("beforeend"," "+X(s.text));const u=b("li",{},m);if(n&&s.step!==void 0){const h=s.step,p=d("web_learn_step_fmt",h+1,n.steps[h].title),x=b("button",{class:"link-button learn-check-link",title:p,"aria-label":`${d("web_learn_review")}: ${p}`},d("web_learn_review"));x.addEventListener("click",()=>{this.returnTo={lesson:n.id,step:H.lesson(n.id).step,scroll:this.body.scrollTop},this.goToStep(n,h)}),u.append(x)}i.append(u)}),i}renderQuiz(e,t,n){const i=b("div",{class:"learn-quiz"}),s=b("p",{class:"learn-score",role:"status"}),r=()=>n?H.lesson(n.id).quiz??{}:{},o=()=>{const l=r(),m=(p,x)=>p.pairs?p.pairs.every((f,I)=>l[`${t}-${x}-${I}`]!==void 0):l[`${t}-${x}`]!==void 0,u=(p,x)=>{var f;return p.pairs?p.pairs.every((I,v)=>ln(p)[l[`${t}-${x}-${v}`]]===p.pairs[v].right):(f=p.options[l[`${t}-${x}`]])==null?void 0:f.correct},c=e.filter(m).length,h=e.filter(u).length;s.textContent=c===e.length?d("web_learn_score_fmt",h,e.length):""};return e.forEach((l,m)=>{const u=`${t}-${m}`,c=b("fieldset",{},Q("legend",{},X(l.question))),h=Q("p",{class:"learn-explanation"},X(l.explanation??""));if(l.pairs){c.append(this.renderMatch(l,u,r,n,h,o),h),i.append(c);return}const p=x=>{c.querySelectorAll("button").forEach((f,I)=>{f.classList.toggle("right",x!==void 0&&l.options[I].correct),f.classList.toggle("wrong",x===I&&!l.options[I].correct),f.setAttribute("aria-pressed",String(x===I))}),h.hidden=x===void 0||!l.explanation};l.options.forEach((x,f)=>{const I=Q("button",{class:"learn-option"},X(x.text));I.addEventListener("click",()=>{n&&H.updateLesson(n.id,{quiz:{...r(),[u]:f}}),p(f),o()}),c.append(I)}),c.append(h),p(r()[u]),i.append(c)}),i.append(s),o(),i}renderMatch(e,t,n,i,s,r){const o=e.pairs,l=ln(e),m=b("div",{class:"learn-match"});let u={};const c=()=>i?n():u,h=I=>i?H.updateLesson(i.id,{quiz:I}):u=I,p=I=>c()[`${t}-${I}`],x=o.map(I=>{const v=b("select",{class:"learn-match-select"});v.append(b("option",{value:""},"–")),l.forEach((j,_)=>v.append(b("option",{value:String(_)},j)));const w=Q("label",{class:"learn-match-left"},X(I.left));return w.append(v),m.append(w),v}),f=()=>{const I=o.every((v,w)=>p(w)!==void 0);x.forEach((v,w)=>{const j=p(w);v.value=j===void 0?"":String(j),v.classList.toggle("right",I&&l[j]===o[w].right),v.classList.toggle("wrong",I&&l[j]!==o[w].right)}),s.hidden=!I||!e.explanation};return x.forEach((I,v)=>I.addEventListener("change",()=>{const w={...c()};I.value===""?delete w[`${t}-${v}`]:w[`${t}-${v}`]=Number(I.value),h(w),f(),r()})),f(),m}}function ln(a){return(a.pairs??[]).map(e=>e.right).sort((e,t)=>e.localeCompare(t,"de"))}const za="visustruct.live.target";function C3(){try{const a=localStorage.getItem(za);return a==="javascript"||a==="python"?a:"java"}catch{return"java"}}const he=a=>a.replace(/&/g,"&").replace(//g,">");function A3(a){let e="",t=a;for(;;){const n=t.indexOf(z1);if(n<0)break;const i=t.indexOf(sa,n);if(i<0)break;e+=he(t.slice(0,n))+`${he(t.slice(n+1,i))}`,t=t.slice(i+1)}return e+he(t)}const T3=(a,e)=>a.length===e.length&&a.every((t,n)=>t===e[n]);function D3(a,e){let t;for(const n of a)en.to||(!t||n.to-n.fromt.path.length)&&(t=n);return t}class W3{constructor(e,t){y(this,"element");y(this,"view");y(this,"spans",[]);y(this,"highlighted");y(this,"html","");y(this,"target",C3());y(this,"last");this.onHide=e,this.onSelect=t,this.element=document.createElement("aside"),this.element.className="livecode",this.build()}build(){this.element.innerHTML=`

${he(d("web_live_title"))}

@@ -20883,8 +20883,8 @@ ${i}`)))}}persist(){H.setView({tab:this.tab,lesson:this.lessonId,task:this.taskI

${he(d("web_live_hint"))}


     `,this.view=this.element.querySelector(".livecode-view"),this.element.querySelector(".learn-hide").addEventListener("click",()=>this.onHide()),this.view.addEventListener("click",e=>{const t=e.target.closest(".ln");if(!t||!this.view.classList.contains("selectable"))return;const n=D3(this.spans,Number(t.dataset.line));n&&this.onSelect(n.path)});for(const e of this.element.querySelectorAll("[data-target]"))e.setAttribute("aria-pressed",String(e.dataset.target===this.target)),e.addEventListener("click",()=>this.setTarget(e.dataset.target));this.highlighted=void 0,this.html=""}setTarget(e){this.target=e;try{localStorage.setItem(za,e)}catch{}for(const t of this.element.querySelectorAll("[data-target]"))t.setAttribute("aria-pressed",String(t.dataset.target===e));this.last&&this.refresh(this.last.doc,this.last.highlight,this.last.selectable)}refresh(e,t,n){var l;this.last={doc:e,highlight:t,selectable:n};const i=is(e,this.target,{condition:d("canvas_stub_condition"),selector:d("web_live_ph_selector"),code:d("web_live_ph_code"),start:d("inspector_for_init"),step:d("inspector_for_step"),end:d("web_live_ph_end")});this.spans=i.spans;const s=t&&i.spans.find(m=>T3(m.path,t));this.view.classList.toggle("selectable",n);const r=i.text.split(`
-`).map((m,u)=>`
${A3(m)||" "}
`).join("");r!==this.html&&(this.view.innerHTML=r),this.html=r;const o=s?`${s.from}-${s.to}`:void 0;o&&o!==this.highlighted&&((l=this.view.querySelector(`.ln[data-line="${s.from}"]`))==null||l.scrollIntoView({block:"nearest"})),this.highlighted=o}}const B3={left:12,top:10},G3=8,g1=8e3,Ae=16,D1=12,va="#fafafa";function wa(a){const e=a.caption.trim();return e===""?d("diagram_title_placeholder"):e}function mn(a){let e=a.trim().replace(/\.visustruct$/i,"");if(e==="")return"";for(e=e.replace(/\s/g,"-").replace(/[/:\\*?"<>|]/g,"-");e.includes("--");)e=e.replace(/--/g,"-");return e=e.replace(/^-+|-+$/g,""),e.length>120&&(e=e.slice(0,120).replace(/^-+|-+$/g,"")),e}function H3(a,e){return mn(a.caption)||mn(e)||"VisuStruct"}function N3(a,e,t){const n=a.split(/\s+/),i=[];let s="";for(const r of n){const o=s?`${s} ${r}`:r;s&&t(o,Ae,"bold")>e?(i.push(s),s=r):s=o}if(s&&i.push(s),i.length>2){let r=i.slice(1).join(" ");for(;r.length>1&&t(r+"…",Ae,"bold")>e;)r=r.slice(0,-1);return[i[0],r+"…"]}return i}function un(a,e,t,n=320){const i={...a,elements:a.elements.map(s1)},s=new jn(e,t).layout(i,B3),r=Math.min(g1,Math.max(n,s.canvasSize.width)),o=Math.min(g1,Math.max(n,s.canvasSize.height));if(r<=2||o<=2)return;const l=N3(wa(a),r-2*D1,t),m=Math.ceil(Ae*1.2),u=Math.min(56,l.length*m+2),c=u+o,h=new An(e,t).render(s,{width:r,height:o},void 0,G3);h.setAttribute("y",String(u)),h.removeAttribute("class");const p=D("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:c,viewBox:`0 0 ${r} ${c}`});p.append(D("rect",{x:0,y:0,width:r,height:c,fill:va}));const x=D("text",{x:D1,y:0,"font-family":p1,"font-size":Ae,"font-weight":600,fill:"black"});return l.forEach((y,I)=>{const v=D("tspan",{x:D1,y:I*m+Ae});v.textContent=y,x.append(v)}),p.append(x,h),{svg:p,width:r,height:c}}function Sa(a){return` -`+new XMLSerializer().serializeToString(a.svg)}async function cn(a,e){const t=Math.max(1,Math.min(e,g1/a.width,g1/a.height)),n=URL.createObjectURL(new Blob([Sa(a)],{type:"image/svg+xml"}));try{const i=new Image;i.src=n,await i.decode();const s=document.createElement("canvas");s.width=Math.round(a.width*t),s.height=Math.round(a.height*t);const r=s.getContext("2d");return r.fillStyle=va,r.fillRect(0,0,s.width,s.height),r.drawImage(i,0,0,s.width,s.height),s}finally{URL.revokeObjectURL(n)}}function E3(a){return new Promise((e,t)=>a.toBlob(n=>n?e(n):t(new Error("PNG konnte nicht erzeugt werden.")),"image/png"))}function L3(a,e){const i=Math.max(1,a),s=Math.max(1,e),r=y=>{const I=y.width-64,v=y.height-64;return{s:Math.min(I/i,v/s)*.98,cw:I,ch:v}},o={width:595,height:842},l={width:842,height:595},m=r(o),u=r(l),[c,h]=u.s>m.s?[l,u]:[o,m],p=i*h.s,x=s*h.s;return{page:c,draw:{x:32+(h.cw-p)/2,y:32+(h.ch-x)/2,width:p,height:x}}}async function V3(a){const e=new Blob([a]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(e).arrayBuffer())}function dn(a){let e="FEFF";for(let t=0;t`}async function R3(a,e,t,n,i){const{page:s,draw:r}=L3(n.width,n.height),o=await V3(a),l=v=>(Math.round(v*100)/100).toString(),m=`q ${l(r.width)} 0 0 ${l(r.height)} ${l(r.x)} ${l(s.height-r.y-r.height)} cm /Im0 Do Q`,u=new TextEncoder,c=[["<< /Type /Catalog /Pages 2 0 R >>"],["<< /Type /Pages /Kids [3 0 R] /Count 1 >>"],[`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${s.width} ${s.height}] /Resources << /XObject << /Im0 4 0 R >> >> /Contents 5 0 R >>`],[`<< /Type /XObject /Subtype /Image /Width ${e} /Height ${t} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /FlateDecode /Length ${o.length} >> +`).map((m,u)=>`
${A3(m)||" "}
`).join("");r!==this.html&&(this.view.innerHTML=r),this.html=r;const o=s?`${s.from}-${s.to}`:void 0;o&&o!==this.highlighted&&((l=this.view.querySelector(`.ln[data-line="${s.from}"]`))==null||l.scrollIntoView({block:"nearest"})),this.highlighted=o}}const B3={left:12,top:10},G3=8,g1=8e3,Ae=16,D1=12,va="#fafafa";function wa(a){const e=a.caption.trim();return e===""?d("diagram_title_placeholder"):e}function mn(a){let e=a.trim().replace(/\.visustruct$/i,"");if(e==="")return"";for(e=e.replace(/\s/g,"-").replace(/[/:\\*?"<>|]/g,"-");e.includes("--");)e=e.replace(/--/g,"-");return e=e.replace(/^-+|-+$/g,""),e.length>120&&(e=e.slice(0,120).replace(/^-+|-+$/g,"")),e}function H3(a,e){return mn(a.caption)||mn(e)||"VisuStruct"}function N3(a,e,t){const n=a.split(/\s+/),i=[];let s="";for(const r of n){const o=s?`${s} ${r}`:r;s&&t(o,Ae,"bold")>e?(i.push(s),s=r):s=o}if(s&&i.push(s),i.length>2){let r=i.slice(1).join(" ");for(;r.length>1&&t(r+"…",Ae,"bold")>e;)r=r.slice(0,-1);return[i[0],r+"…"]}return i}function un(a,e,t,n=320){const i={...a,elements:a.elements.map(s1)},s=new jn(e,t).layout(i,B3),r=Math.min(g1,Math.max(n,s.canvasSize.width)),o=Math.min(g1,Math.max(n,s.canvasSize.height));if(r<=2||o<=2)return;const l=N3(wa(a),r-2*D1,t),m=Math.ceil(Ae*1.2),u=Math.min(56,l.length*m+2),c=u+o,h=new An(e,t).render(s,{width:r,height:o},void 0,G3);h.setAttribute("y",String(u)),h.removeAttribute("class");const p=D("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:c,viewBox:`0 0 ${r} ${c}`});p.append(D("rect",{x:0,y:0,width:r,height:c,fill:va}));const x=D("text",{x:D1,y:0,"font-family":p1,"font-size":Ae,"font-weight":600,fill:"black"});return l.forEach((f,I)=>{const v=D("tspan",{x:D1,y:I*m+Ae});v.textContent=f,x.append(v)}),p.append(x,h),{svg:p,width:r,height:c}}function Sa(a){return` +`+new XMLSerializer().serializeToString(a.svg)}async function cn(a,e){const t=Math.max(1,Math.min(e,g1/a.width,g1/a.height)),n=URL.createObjectURL(new Blob([Sa(a)],{type:"image/svg+xml"}));try{const i=new Image;i.src=n,await i.decode();const s=document.createElement("canvas");s.width=Math.round(a.width*t),s.height=Math.round(a.height*t);const r=s.getContext("2d");return r.fillStyle=va,r.fillRect(0,0,s.width,s.height),r.drawImage(i,0,0,s.width,s.height),s}finally{URL.revokeObjectURL(n)}}function E3(a){return new Promise((e,t)=>a.toBlob(n=>n?e(n):t(new Error("PNG konnte nicht erzeugt werden.")),"image/png"))}function L3(a,e){const i=Math.max(1,a),s=Math.max(1,e),r=f=>{const I=f.width-64,v=f.height-64;return{s:Math.min(I/i,v/s)*.98,cw:I,ch:v}},o={width:595,height:842},l={width:842,height:595},m=r(o),u=r(l),[c,h]=u.s>m.s?[l,u]:[o,m],p=i*h.s,x=s*h.s;return{page:c,draw:{x:32+(h.cw-p)/2,y:32+(h.ch-x)/2,width:p,height:x}}}async function V3(a){const e=new Blob([a]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(e).arrayBuffer())}function dn(a){let e="FEFF";for(let t=0;t`}async function R3(a,e,t,n,i){const{page:s,draw:r}=L3(n.width,n.height),o=await V3(a),l=v=>(Math.round(v*100)/100).toString(),m=`q ${l(r.width)} 0 0 ${l(r.height)} ${l(r.x)} ${l(s.height-r.y-r.height)} cm /Im0 Do Q`,u=new TextEncoder,c=[["<< /Type /Catalog /Pages 2 0 R >>"],["<< /Type /Pages /Kids [3 0 R] /Count 1 >>"],[`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${s.width} ${s.height}] /Resources << /XObject << /Im0 4 0 R >> >> /Contents 5 0 R >>`],[`<< /Type /XObject /Subtype /Image /Width ${e} /Height ${t} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /FlateDecode /Length ${o.length} >> stream `,o,` endstream`],[`<< /Length ${m.length} >> @@ -20892,13 +20892,13 @@ stream ${m} endstream`],[`<< /Creator ${dn("VisuStruct")} /Title ${dn(i)} >>`]],h=[];let p=0;const x=v=>{const w=typeof v=="string"?u.encode(v):v;h.push(w),p+=w.length};x(`%PDF-1.4 %âãÏÓ -`);const y=[];c.forEach((v,w)=>{y.push(p),x(`${w+1} 0 obj +`);const f=[];c.forEach((v,w)=>{f.push(p),x(`${w+1} 0 obj `),v.forEach(x),x(` endobj `)});const I=p;x(`xref 0 ${c.length+1} 0000000000 65535 f -`);for(const v of y)x(`${String(v).padStart(10,"0")} 00000 n +`);for(const v of f)x(`${String(v).padStart(10,"0")} 00000 n `);return x(`trailer << /Size ${c.length+1} /Root 1 0 R /Info ${c.length} 0 R >> startxref @@ -20906,7 +20906,7 @@ ${I} %%EOF `),new Blob(h,{type:"application/pdf"})}function U3(a){const{data:e}=a.getContext("2d").getImageData(0,0,a.width,a.height),t=new Uint8Array(a.width*a.height*3);for(let n=0,i=0;n[{description:d("web_file_type"),accept:{"application/xml":[".visustruct",".strk"]}}],W1=a=>d(`element_${g[a]}`),F3={[g.verzweigung]:"age >= 18",[g.whileSchleife]:"i < 10",[g.doUntilSchleife]:"again == 1",[g.fallauswahl]:"day"},Y3={statement:'int number = 5 | double x = 1.5 | String text = "Your text" | boolean ok = true | const double PI = 3.14',input:'input: int age "Enter age" | input: double price "Enter price" | input: String name "Enter name"',output:'output: number | output: "Your text" | output: "Your age: " + age'};function gn(a){switch(a.type){case g.anweisung:{const e=a1(a.textLines.join(` `));return e==="input"?"input:":e==="output"?"output:":void 0}case g.verzweigung:return"if";case g.whileSchleife:case g.doUntilSchleife:return"while";case g.fallauswahl:return"switch";default:return}}function O3(a){switch(a.type){case g.anweisung:{const e=a1(a.textLines.join(` -`));return e==="input"?'int age "Enter age"':e==="output"?'"Your age: " + age':d("inspector_placeholder_statement")}case g.verzweigung:case g.whileSchleife:case g.doUntilSchleife:case g.endlosschleife:return d("inspector_placeholder_condition");case g.fallauswahl:return d("inspector_placeholder_selector");case g.aufruf:return d("inspector_placeholder_call");case g.aussprung:return d("inspector_placeholder_break");default:return""}}function T(a,e={},...t){const n=document.createElement(a);for(const[i,s]of Object.entries(e))n.setAttribute(i,s);return n.append(...t),n}const pn=[{value:1,label:"settings_ui_scale_small"},{value:1.22,label:"settings_ui_scale_medium"},{value:1.5,label:"settings_ui_scale_large"},{value:1.82,label:"settings_ui_scale_extra_large"}],Q3=/Mac|iPhone|iPad/.test(navigator.platform);function Qe(a){const e=Se(),t=e==="pt-PT"?"pt":e==="de"?"de":"en";return`${/\/app\/(index\.html)?$/.test(location.pathname)?"../":"https://visustruct.org/"}${t}/index.html${a?`#${a}`:""}`}function ue(a,e=!1){return Q3?`${e?"⇧":""}⌘${a}`:[d("web_key_ctrl"),...e?[d("web_key_shift")]:[],a].join("+")}const k=$3,xn="visustruct.ui.scale.canvas",In="visustruct.learn.open",X3="visustruct.learn.width",bn="visustruct.live.open",J3="visustruct.live.width",q3=80;class K3{constructor(e){b(this,"tabs",[]);b(this,"tabIndex",0);b(this,"nextTabSerial",1);b(this,"clipboard");b(this,"zoom",1);b(this,"simulating",!1);b(this,"exportSelect");b(this,"learn");b(this,"shell");b(this,"learning",!1);b(this,"learnButton");b(this,"railButton");b(this,"liveRailButton");b(this,"exerciseSaveTimer");b(this,"resizeObserver");b(this,"renderedHostSize",{width:-1,height:-1});b(this,"simPath");b(this,"sim");b(this,"simButton");b(this,"coding",!1);b(this,"code");b(this,"codeButton");b(this,"liveCoding",!1);b(this,"live");b(this,"liveButton");b(this,"measure",qa());b(this,"metrics",Ka());b(this,"engine",new jn(this.metrics,this.measure));b(this,"renderer",new An(this.metrics,this.measure));b(this,"layout");b(this,"flat",[]);b(this,"canvasHost");b(this,"svg");b(this,"overlay");b(this,"inspector");b(this,"captionInput");b(this,"undoButton");b(this,"redoButton");b(this,"deleteButton");b(this,"statusLine");b(this,"drag");b(this,"downloads",null);b(this,"inViewer","claude"in window);b(this,"tabStrip");this.root=e,this.tabs.push(this.makeTab()),this.learn=new P3(this.learnHost()),this.shell=document.createElement("div"),this.shell.className="shell",e.replaceWith(this.shell),this.live=new W3(()=>this.setLiveCoding(!1),o=>{this.selected=o,this.render()}),this.shell.append(this.learnRail(),this.learn.element,this.learnResizer(),e,this.liveResizer(),this.live.element,this.liveRail());const t=Xe(In),n=new URLSearchParams(location.search),i=n.has("learn");if(i){n.delete("learn");const o=n.toString();history.replaceState(history.state,"",`${location.pathname}${o?`?${o}`:""}${location.hash}`)}this.setLearning(i||(t===null?window.innerWidth>1100:t==="1"),i);const s=Number(Xe(xn));pn.some(o=>o.value===s)&&(this.zoom=s),this.setLiveCoding(Xe(bn)==="1"),this.buildUI(),this.render(),window.addEventListener("pointermove",o=>this.onPointerMove(o)),window.addEventListener("pointerup",o=>this.onPointerUp(o)),window.addEventListener("pointercancel",()=>this.endDrag()),window.addEventListener("keydown",o=>this.onKeyDown(o)),window.addEventListener("beforeunload",o=>{this.tabs.some(l=>l.dirty&&!l.exerciseId)&&o.preventDefault()}),this.setupFileDrop();const r=window.claude;r==null||r.use("downloads").then(o=>this.downloads=o)}get tab(){return this.tabs[this.tabIndex]}get doc(){return this.tab.doc}set doc(e){this.tab.doc=e}get fileName(){return this.tab.fileName??`${fe(this.tab)}.visustruct`}get fileHandle(){return this.tab.fileHandle}set fileHandle(e){this.tab.fileHandle=e}get dirty(){return this.tab.dirty}set dirty(e){this.tab.dirty=e}get undoStack(){return this.tab.undoStack}get redoStack(){return this.tab.redoStack}get selected(){return this.tab.selected}set selected(e){this.tab.selected=e}buildUI(){var o;this.root.className="app",this.root.innerHTML=` +`));return e==="input"?'int age "Enter age"':e==="output"?'"Your age: " + age':d("inspector_placeholder_statement")}case g.verzweigung:case g.whileSchleife:case g.doUntilSchleife:case g.endlosschleife:return d("inspector_placeholder_condition");case g.fallauswahl:return d("inspector_placeholder_selector");case g.aufruf:return d("inspector_placeholder_call");case g.aussprung:return d("inspector_placeholder_break");default:return""}}function T(a,e={},...t){const n=document.createElement(a);for(const[i,s]of Object.entries(e))n.setAttribute(i,s);return n.append(...t),n}const pn=[{value:1,label:"settings_ui_scale_small"},{value:1.22,label:"settings_ui_scale_medium"},{value:1.5,label:"settings_ui_scale_large"},{value:1.82,label:"settings_ui_scale_extra_large"}],Q3=/Mac|iPhone|iPad/.test(navigator.platform);function Qe(a){const e=Se(),t=e==="pt-PT"?"pt":e==="de"?"de":"en";return`${/\/app\/(index\.html)?$/.test(location.pathname)?"../":"https://visustruct.org/"}${t}/index.html${a?`#${a}`:""}`}function ue(a,e=!1){return Q3?`${e?"⇧":""}⌘${a}`:[d("web_key_ctrl"),...e?[d("web_key_shift")]:[],a].join("+")}const k=$3,xn="visustruct.ui.scale.canvas",In="visustruct.learn.open",X3="visustruct.learn.width",bn="visustruct.live.open",J3="visustruct.live.width",q3=80;class K3{constructor(e){y(this,"tabs",[]);y(this,"tabIndex",0);y(this,"nextTabSerial",1);y(this,"clipboard");y(this,"zoom",1);y(this,"simulating",!1);y(this,"exportSelect");y(this,"learn");y(this,"shell");y(this,"railButton");y(this,"liveRailButton");y(this,"exerciseSaveTimer");y(this,"resizeObserver");y(this,"renderedHostSize",{width:-1,height:-1});y(this,"simPath");y(this,"sim");y(this,"simButton");y(this,"coding",!1);y(this,"code");y(this,"codeButton");y(this,"liveCoding",!1);y(this,"live");y(this,"measure",qa());y(this,"metrics",Ka());y(this,"engine",new jn(this.metrics,this.measure));y(this,"renderer",new An(this.metrics,this.measure));y(this,"layout");y(this,"flat",[]);y(this,"canvasHost");y(this,"svg");y(this,"overlay");y(this,"inspector");y(this,"captionInput");y(this,"undoButton");y(this,"redoButton");y(this,"deleteButton");y(this,"statusLine");y(this,"drag");y(this,"downloads",null);y(this,"inViewer","claude"in window);y(this,"tabStrip");this.root=e,this.tabs.push(this.makeTab()),this.learn=new P3(this.learnHost()),this.shell=document.createElement("div"),this.shell.className="shell",e.replaceWith(this.shell),this.live=new W3(()=>this.setLiveCoding(!1),o=>{this.selected=o,this.render()}),this.shell.append(this.learnRail(),this.learn.element,this.learnResizer(),e,this.liveResizer(),this.live.element,this.liveRail());const t=Xe(In),n=new URLSearchParams(location.search),i=n.has("learn");if(i){n.delete("learn");const o=n.toString();history.replaceState(history.state,"",`${location.pathname}${o?`?${o}`:""}${location.hash}`)}this.setLearning(i||(t===null?window.innerWidth>1100:t==="1"),i);const s=Number(Xe(xn));pn.some(o=>o.value===s)&&(this.zoom=s),this.setLiveCoding(Xe(bn)==="1"),this.buildUI(),this.render(),window.addEventListener("pointermove",o=>this.onPointerMove(o)),window.addEventListener("pointerup",o=>this.onPointerUp(o)),window.addEventListener("pointercancel",()=>this.endDrag()),window.addEventListener("keydown",o=>this.onKeyDown(o)),window.addEventListener("beforeunload",o=>{this.tabs.some(l=>l.dirty&&!l.exerciseId)&&o.preventDefault()}),this.setupFileDrop();const r=window.claude;r==null||r.use("downloads").then(o=>this.downloads=o)}get tab(){return this.tabs[this.tabIndex]}get doc(){return this.tab.doc}set doc(e){this.tab.doc=e}get fileName(){return this.tab.fileName??`${fe(this.tab)}.visustruct`}get fileHandle(){return this.tab.fileHandle}set fileHandle(e){this.tab.fileHandle=e}get dirty(){return this.tab.dirty}set dirty(e){this.tab.dirty=e}get undoStack(){return this.tab.undoStack}get redoStack(){return this.tab.redoStack}get selected(){return this.tab.selected}set selected(e){this.tab.selected=e}buildUI(){var o;this.root.className="app",this.root.innerHTML=`
VisuStruct ${k(d("web_brand_suffix"))}
@@ -20934,8 +20934,6 @@ ${I}
- -
@@ -20960,12 +20958,12 @@ ${I} - `;const e=l=>this.root.querySelector(l);this.canvasHost=e(".canvas"),this.inspector=e(".inspector"),this.captionInput=e(".caption"),this.undoButton=e("[data-action=undo]"),this.redoButton=e("[data-action=redo]"),this.deleteButton=e("[data-action=delete]"),this.statusLine=e(".status"),this.simButton=e("[data-action=simulate]"),this.sim=new v3(()=>this.doc,l=>{this.simPath=l,this.simulating&&this.renderDiagramOnly(),this.scrollToSimPath()},l=>this.findSubprogram(l),()=>this.setSimulating(!1)),this.root.append(this.sim.element),this.simButton.addEventListener("click",()=>this.setSimulating(!this.simulating)),this.codeButton=e("[data-action=code]"),this.code=new gs(()=>this.doc,(l,m)=>this.offerDownload(l,new Blob([m],{type:"text/plain"})),()=>this.setCoding(!1),l=>this.commit({...this.doc,pseudocode:l||void 0}),()=>this.tabs.filter(l=>l!==this.tab&&pe(l.doc.caption)).map(l=>l.doc)),this.root.append(this.code.element),this.codeButton.addEventListener("click",()=>this.setCoding(!this.coding));const t=e(".palette ul");for(const{item:l}of Zt){const m=W1(Re(l).type),u=document.createElement("li");u.className="palette-item",u.dataset.item=l,u.append(this.paletteIcon(l),document.createTextNode(m)),u.addEventListener("pointerdown",c=>this.beginDrag(c,{kind:"palette",item:l})),u.tabIndex=0,u.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&this.insertNearSelection(Re(l))}),t.append(u)}this.learnButton=e("[data-action=learn]"),this.learnButton.addEventListener("click",()=>this.setLearning(!this.learning)),this.learnButton.setAttribute("aria-pressed",String(this.learning)),this.liveButton=e("[data-action=live]"),this.liveButton.addEventListener("click",()=>this.setLiveCoding(!this.liveCoding)),this.liveButton.setAttribute("aria-pressed",String(this.liveCoding)),this.tabStrip=e(".tabs"),this.exportSelect=e("[data-action=export]"),this.exportSelect.addEventListener("change",()=>{const l=this.exportSelect.value;this.exportSelect.value="",l&&this.exportDiagram(l)});const n=e("[data-action=language]");n.value=Se(),n.addEventListener("change",()=>void this.changeLanguage(n.value));const i=e("[data-action=zoom]");i.value=String(this.zoom),i.addEventListener("change",()=>{this.zoom=Number(i.value),Je(xn,i.value),this.renderDiagramOnly()}),e("[data-action=cut]").addEventListener("click",()=>this.cutSelection()),e("[data-action=copy]").addEventListener("click",()=>this.copySelection()),e("[data-action=paste]").addEventListener("click",()=>this.paste());const s=e("input[type=file]");s.addEventListener("change",async()=>{var m;const l=(m=s.files)==null?void 0:m[0];s.value="",l&&this.loadXML(await l.text(),l.name)}),e("[data-action=new]").addEventListener("click",()=>this.addTab()),e("[data-action=open]").addEventListener("click",()=>this.open(s)),e("[data-action=save]").addEventListener("click",()=>this.save()),this.undoButton.addEventListener("click",()=>this.undo()),this.redoButton.addEventListener("click",()=>this.redo()),this.deleteButton.addEventListener("click",()=>this.deleteSelection());let r;this.captionInput.addEventListener("focus",()=>r=this.doc),this.captionInput.addEventListener("input",()=>{this.doc={...this.doc,caption:this.captionInput.value},this.dirty=!0,this.updateStatus()}),this.captionInput.addEventListener("change",()=>{r&&r.caption!==this.doc.caption&&this.pushUndo(r),r=this.doc}),this.canvasHost.addEventListener("pointerdown",l=>this.onCanvasPointerDown(l)),(o=this.resizeObserver)==null||o.disconnect(),this.resizeObserver=new ResizeObserver(()=>{const{clientWidth:l,clientHeight:m}=this.canvasHost;l===this.renderedHostSize.width&&m===this.renderedHostSize.height||this.renderDiagramOnly()}),this.resizeObserver.observe(this.canvasHost)}async changeLanguage(e){this.setSimulating(!1),this.setCoding(!1),await Hn(e),ka(),this.sim.end(),this.live.build(),this.buildUI(),this.render(),this.learn.render(),this.labelLearnRail(),this.labelLiveRail()}setLearning(e,t=!0){var n;this.learning=e,this.shell.classList.toggle("learning",e),(n=this.learnButton)==null||n.setAttribute("aria-pressed",String(e)),t&&Je(In,e?"1":"0"),this.canvasHost&&this.renderDiagramOnly()}learnRail(){return this.railButton=T("button",{class:"learn-rail"}),this.labelLearnRail(),this.railButton.addEventListener("click",()=>this.setLearning(!0)),this.railButton}liveRail(){return this.liveRailButton=T("button",{class:"learn-rail live-rail"}),this.labelLiveRail(),this.liveRailButton.addEventListener("click",()=>this.setLiveCoding(!0)),this.liveRailButton}labelLiveRail(){this.liveRailButton&&(this.liveRailButton.title=d("web_live_show"),this.liveRailButton.innerHTML=`${h1}</> ${k(d("web_live_title"))}`)}labelLearnRail(){this.railButton&&(this.railButton.title=d("web_learn_show"),this.railButton.innerHTML=`${h1}🎓 ${k(d("web_learn_title"))}`)}learnHost(){return{collapse:()=>this.setLearning(!1),openExercise:(e,t)=>{const n=this.tabs.findIndex(s=>s.exerciseId===e.id);if(n>=0){this.switchTab(n),this.setSimulating(!1);return}const i=this.makeTab();i.doc=t,i.exerciseId=e.id,i.selected=t.elements.length>0?[0]:void 0,this.isPristine(this.tab)?this.tabs[this.tabIndex]=i:this.tabs.push(i),this.tabIndex=this.tabs.indexOf(i),this.setSimulating(!1),this.render()},openDiagram:(e,t)=>{this.loadXML(M1(e),e.caption.trim()?`${e.caption.trim()}.visustruct`:t)},exerciseDocument:e=>{var t;return(t=this.tabs.find(n=>n.exerciseId===e))==null?void 0:t.doc},subprogramsFor:e=>{const t=this.tabs.find(n=>n.exerciseId===e);return n=>this.findSubprogram(n,t)},stopSimulation:()=>this.setSimulating(!1),resetExercise:(e,t)=>{const n=this.tabs.find(i=>i.exerciseId===e);n&&(n.undoStack.push(n.doc),n.doc=t,n.redoStack=[],n.selected=[0],n===this.tab&&this.render())},preview:e=>{const t=un(e,this.metrics,this.measure,0);if(!t)return;const n=t.svg.getAttribute("width");return n&&(t.svg.style.maxWidth=`${n}px`),t.svg.removeAttribute("width"),t.svg.removeAttribute("height"),t.svg}}}isPristine(e){return!e.dirty&&!e.fileName&&!e.exerciseId&&e.undoStack.length===0}rememberExercise(){const e=this.tab;e.exerciseId&&(clearTimeout(this.exerciseSaveTimer),this.exerciseSaveTimer=window.setTimeout(()=>{e.exerciseId&&H.updateExercise(e.exerciseId,{xml:M1(e.doc)})},300))}paletteIcon(e){const t=D("svg",{viewBox:"0 0 28 20",width:28,height:20,class:"icon"}),n={fill:"none",stroke:"currentColor","stroke-width":1.5};t.append(D("rect",{x:1,y:1,width:26,height:18,...n}));const i=s=>t.append(D("path",{d:s,...n}));switch(e){case"verzweigung":i("M1 1 L14 10 L27 1 M14 10 V19");break;case"fallauswahl":i("M1 1 L20 10 L27 1 M1 10 H27 M10 10 V19 M20 10 V19");break;case"forZaehlSchleife":case"whileSchleife":i("M7 7 H27 M7 7 V19");break;case"doUntilSchleife":i("M7 1 V13 H27");break;case"endlosschleife":i("M7 6 H27 M7 6 V14 H27");break;case"aufruf":i("M5 1 V19 M23 1 V19");break;case"aussprung":i("M6 1 L1 10 L6 19");break}return t}render(){const e={...this.doc,elements:this.doc.elements.map(s1)};this.layout=this.engine.layout(e),this.flat=ii(this.layout.elements),this.selected&&!$(this.doc,this.selected)&&(this.selected=void 0);const t=this.zoom,n=this.canvasHost;this.renderedHostSize={width:n.clientWidth,height:n.clientHeight};const i={width:Math.max(320,this.layout.canvasSize.width,Math.floor(n.clientWidth/t)),height:Math.max(240,this.layout.canvasSize.height+60,Math.floor(n.clientHeight/t))};this.renderer.usesSimulationHighlight=this.simulating,this.svg=this.renderer.render(this.layout,i,this.simulating?this.simPath:this.selected),this.svg.setAttribute("width",String(Math.floor(i.width*t))),this.svg.setAttribute("height",String(Math.floor(i.height*t))),this.overlay=D("g",{class:"drop-overlay"}),this.svg.append(this.overlay),this.canvasHost.replaceChildren(this.svg),document.activeElement!==this.captionInput&&(this.captionInput.value=this.doc.caption),this.undoButton.disabled=this.simulating||this.undoStack.length===0,this.redoButton.disabled=this.simulating||this.redoStack.length===0,this.deleteButton.disabled=this.simulating||!this.selected||!S1(this.doc,this.selected),this.captionInput.readOnly=this.simulating,this.codeButton.disabled=this.simulating,this.exportSelect.disabled=this.simulating,this.coding&&this.code.refresh(),this.liveCoding&&this.live.refresh(this.doc,this.simulating?this.simPath:this.selected,!this.simulating),this.renderTabs(),this.renderInspector(),this.updateStatus()}updateStatus(){this.rememberExercise(),document.title=`${this.dirty?"• ":""}${this.fileName} – VisuStruct Web`,this.statusLine.textContent=`${this.fileName}${this.dirty?` (${d("web_status_modified")})`:""}`}renderInspector(){const e=this.selected,t=e?$(this.doc,e):void 0,n=this.inspector;if(!e||!t){n.replaceChildren(T("h2",{},d("web_inspector_title")),T("p",{class:"hint"},d("inspector_no_selection")),T("p",{class:"hint"},d("web_inspector_help_drop")),T("p",{class:"hint"},d("web_inspector_help_files")));return}if(n.replaceChildren(T("h2",{},`${d("web_inspector_title")} · ${W1(t.type)}`)),t.type===g.anweisung){const i=a1(t.textLines.join(` + `;const e=l=>this.root.querySelector(l);this.canvasHost=e(".canvas"),this.inspector=e(".inspector"),this.captionInput=e(".caption"),this.undoButton=e("[data-action=undo]"),this.redoButton=e("[data-action=redo]"),this.deleteButton=e("[data-action=delete]"),this.statusLine=e(".status"),this.simButton=e("[data-action=simulate]"),this.sim=new v3(()=>this.doc,l=>{this.simPath=l,this.simulating&&this.renderDiagramOnly(),this.scrollToSimPath()},l=>this.findSubprogram(l),()=>this.setSimulating(!1)),this.root.append(this.sim.element),this.simButton.addEventListener("click",()=>this.setSimulating(!this.simulating)),this.codeButton=e("[data-action=code]"),this.code=new gs(()=>this.doc,(l,m)=>this.offerDownload(l,new Blob([m],{type:"text/plain"})),()=>this.setCoding(!1),l=>this.commit({...this.doc,pseudocode:l||void 0}),()=>this.tabs.filter(l=>l!==this.tab&&pe(l.doc.caption)).map(l=>l.doc)),this.root.append(this.code.element),this.codeButton.addEventListener("click",()=>this.setCoding(!this.coding));const t=e(".palette ul");for(const{item:l}of Zt){const m=W1(Re(l).type),u=document.createElement("li");u.className="palette-item",u.dataset.item=l,u.append(this.paletteIcon(l),document.createTextNode(m)),u.addEventListener("pointerdown",c=>this.beginDrag(c,{kind:"palette",item:l})),u.tabIndex=0,u.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&this.insertNearSelection(Re(l))}),t.append(u)}this.tabStrip=e(".tabs"),this.exportSelect=e("[data-action=export]"),this.exportSelect.addEventListener("change",()=>{const l=this.exportSelect.value;this.exportSelect.value="",l&&this.exportDiagram(l)});const n=e("[data-action=language]");n.value=Se(),n.addEventListener("change",()=>void this.changeLanguage(n.value));const i=e("[data-action=zoom]");i.value=String(this.zoom),i.addEventListener("change",()=>{this.zoom=Number(i.value),Je(xn,i.value),this.renderDiagramOnly()}),e("[data-action=cut]").addEventListener("click",()=>this.cutSelection()),e("[data-action=copy]").addEventListener("click",()=>this.copySelection()),e("[data-action=paste]").addEventListener("click",()=>this.paste());const s=e("input[type=file]");s.addEventListener("change",async()=>{var m;const l=(m=s.files)==null?void 0:m[0];s.value="",l&&this.loadXML(await l.text(),l.name)}),e("[data-action=new]").addEventListener("click",()=>this.addTab()),e("[data-action=open]").addEventListener("click",()=>this.open(s)),e("[data-action=save]").addEventListener("click",()=>this.save()),this.undoButton.addEventListener("click",()=>this.undo()),this.redoButton.addEventListener("click",()=>this.redo()),this.deleteButton.addEventListener("click",()=>this.deleteSelection());let r;this.captionInput.addEventListener("focus",()=>r=this.doc),this.captionInput.addEventListener("input",()=>{this.doc={...this.doc,caption:this.captionInput.value},this.dirty=!0,this.updateStatus()}),this.captionInput.addEventListener("change",()=>{r&&r.caption!==this.doc.caption&&this.pushUndo(r),r=this.doc}),this.canvasHost.addEventListener("pointerdown",l=>this.onCanvasPointerDown(l)),(o=this.resizeObserver)==null||o.disconnect(),this.resizeObserver=new ResizeObserver(()=>{const{clientWidth:l,clientHeight:m}=this.canvasHost;l===this.renderedHostSize.width&&m===this.renderedHostSize.height||this.renderDiagramOnly()}),this.resizeObserver.observe(this.canvasHost)}async changeLanguage(e){this.setSimulating(!1),this.setCoding(!1),await Hn(e),ka(),this.sim.end(),this.live.build(),this.buildUI(),this.render(),this.learn.render(),this.labelLearnRail(),this.labelLiveRail()}setLearning(e,t=!0){this.shell.classList.toggle("learning",e),t&&Je(In,e?"1":"0"),this.canvasHost&&this.renderDiagramOnly()}learnRail(){return this.railButton=T("button",{class:"learn-rail"}),this.labelLearnRail(),this.railButton.addEventListener("click",()=>this.setLearning(!0)),this.railButton}liveRail(){return this.liveRailButton=T("button",{class:"learn-rail live-rail"}),this.labelLiveRail(),this.liveRailButton.addEventListener("click",()=>this.setLiveCoding(!0)),this.liveRailButton}labelLiveRail(){this.liveRailButton&&(this.liveRailButton.title=d("web_live_show"),this.liveRailButton.innerHTML=`${h1}</> ${k(d("web_live_title"))}`)}labelLearnRail(){this.railButton&&(this.railButton.title=d("web_learn_show"),this.railButton.innerHTML=`${h1}🎓 ${k(d("web_learn_title"))}`)}learnHost(){return{collapse:()=>this.setLearning(!1),openExercise:(e,t)=>{const n=this.tabs.findIndex(s=>s.exerciseId===e.id);if(n>=0){this.switchTab(n),this.setSimulating(!1);return}const i=this.makeTab();i.doc=t,i.exerciseId=e.id,i.selected=t.elements.length>0?[0]:void 0,this.isPristine(this.tab)?this.tabs[this.tabIndex]=i:this.tabs.push(i),this.tabIndex=this.tabs.indexOf(i),this.setSimulating(!1),this.render()},openDiagram:(e,t)=>{this.loadXML(M1(e),e.caption.trim()?`${e.caption.trim()}.visustruct`:t)},exerciseDocument:e=>{var t;return(t=this.tabs.find(n=>n.exerciseId===e))==null?void 0:t.doc},subprogramsFor:e=>{const t=this.tabs.find(n=>n.exerciseId===e);return n=>this.findSubprogram(n,t)},stopSimulation:()=>this.setSimulating(!1),resetExercise:(e,t)=>{const n=this.tabs.find(i=>i.exerciseId===e);n&&(n.undoStack.push(n.doc),n.doc=t,n.redoStack=[],n.selected=[0],n===this.tab&&this.render())},preview:e=>{const t=un(e,this.metrics,this.measure,0);if(!t)return;const n=t.svg.getAttribute("width");return n&&(t.svg.style.maxWidth=`${n}px`),t.svg.removeAttribute("width"),t.svg.removeAttribute("height"),t.svg}}}isPristine(e){return!e.dirty&&!e.fileName&&!e.exerciseId&&e.undoStack.length===0}rememberExercise(){const e=this.tab;e.exerciseId&&(clearTimeout(this.exerciseSaveTimer),this.exerciseSaveTimer=window.setTimeout(()=>{e.exerciseId&&H.updateExercise(e.exerciseId,{xml:M1(e.doc)})},300))}paletteIcon(e){const t=D("svg",{viewBox:"0 0 28 20",width:28,height:20,class:"icon"}),n={fill:"none",stroke:"currentColor","stroke-width":1.5};t.append(D("rect",{x:1,y:1,width:26,height:18,...n}));const i=s=>t.append(D("path",{d:s,...n}));switch(e){case"verzweigung":i("M1 1 L14 10 L27 1 M14 10 V19");break;case"fallauswahl":i("M1 1 L20 10 L27 1 M1 10 H27 M10 10 V19 M20 10 V19");break;case"forZaehlSchleife":case"whileSchleife":i("M7 7 H27 M7 7 V19");break;case"doUntilSchleife":i("M7 1 V13 H27");break;case"endlosschleife":i("M7 6 H27 M7 6 V14 H27");break;case"aufruf":i("M5 1 V19 M23 1 V19");break;case"aussprung":i("M6 1 L1 10 L6 19");break}return t}render(){const e={...this.doc,elements:this.doc.elements.map(s1)};this.layout=this.engine.layout(e),this.flat=ii(this.layout.elements),this.selected&&!$(this.doc,this.selected)&&(this.selected=void 0);const t=this.zoom,n=this.canvasHost;this.renderedHostSize={width:n.clientWidth,height:n.clientHeight};const i={width:Math.max(320,this.layout.canvasSize.width,Math.floor(n.clientWidth/t)),height:Math.max(240,this.layout.canvasSize.height+60,Math.floor(n.clientHeight/t))};this.renderer.usesSimulationHighlight=this.simulating,this.svg=this.renderer.render(this.layout,i,this.simulating?this.simPath:this.selected),this.svg.setAttribute("width",String(Math.floor(i.width*t))),this.svg.setAttribute("height",String(Math.floor(i.height*t))),this.overlay=D("g",{class:"drop-overlay"}),this.svg.append(this.overlay),this.canvasHost.replaceChildren(this.svg),document.activeElement!==this.captionInput&&(this.captionInput.value=this.doc.caption),this.undoButton.disabled=this.simulating||this.undoStack.length===0,this.redoButton.disabled=this.simulating||this.redoStack.length===0,this.deleteButton.disabled=this.simulating||!this.selected||!S1(this.doc,this.selected),this.captionInput.readOnly=this.simulating,this.codeButton.disabled=this.simulating,this.exportSelect.disabled=this.simulating,this.coding&&this.code.refresh(),this.liveCoding&&this.live.refresh(this.doc,this.simulating?this.simPath:this.selected,!this.simulating),this.renderTabs(),this.renderInspector(),this.updateStatus()}updateStatus(){this.rememberExercise(),document.title=`${this.dirty?"• ":""}${this.fileName} – VisuStruct Web`,this.statusLine.textContent=`${this.fileName}${this.dirty?` (${d("web_status_modified")})`:""}`}renderInspector(){const e=this.selected,t=e?$(this.doc,e):void 0,n=this.inspector;if(!e||!t){n.replaceChildren(T("h2",{},d("web_inspector_title")),T("p",{class:"hint"},d("inspector_no_selection")),T("p",{class:"hint"},d("web_inspector_help_drop")),T("p",{class:"hint"},d("web_inspector_help_files")));return}if(n.replaceChildren(T("h2",{},`${d("web_inspector_title")} · ${W1(t.type)}`)),t.type===g.anweisung){const i=a1(t.textLines.join(` `)),s=T("div",{class:"segmented",role:"group","aria-label":d("inspector_io_mode_title")});for(const[r,o]of[["statement",d("inspector_io_mode_statement")],["input",d("inspector_io_mode_input")],["output",d("inspector_io_mode_output")]]){const l=T("button",{"aria-pressed":String(r===i)},o);l.addEventListener("click",()=>{var c,h;const m=((c=$(this.doc,e))==null?void 0:c.textLines.join(` `))??"";if(r===a1(m))return;const u=Fa(r,m);this.commit(w1(this.doc,e,u.split(` `))),(h=this.inspector.querySelector("textarea"))==null||h.focus()}),s.append(l)}n.append(s,T("p",{class:"hint mono-hint"},Y3[i]))}if(t.type===g.forSchleife){const i=T("div",{class:"for-fields"}),s=St(t.textLines);[[d("inspector_for_init"),d("inspector_for_placeholder_init")],[d("inspector_for_condition"),d("inspector_for_placeholder_condition")],[d("inspector_for_step"),d("inspector_for_placeholder_step")]].forEach(([o,l],m)=>{const u=T("input",{placeholder:l,spellcheck:"false",autocomplete:"off"});u.value=s[m],this.liveEdit(u,c=>{const h=$(this.doc,e);if(!h)return;const p=St(h.textLines);return p[m]=Qa(c),w1(this.doc,e,p)}),i.append(T("label",{},o,u))}),n.append(i)}else if(t.type!==g.leerElement){const i=F3[t.type];i&&n.append(T("p",{class:"hint mono-hint"},i));const s=gn(t),r=T("textarea",{rows:"3",spellcheck:"false"}),o=t.textLines.join(` `);r.value=s?wt(s,o):o,r.placeholder=O3(t),r.addEventListener("focus",()=>{r.value.trim()==="ø"&&r.select()}),this.liveEdit(r,m=>{const u=gn($(this.doc,e)??t),c=u?Oa(u,wt(u,m)):m;return w1(this.doc,e,c.split(` -`))});const l=T("div",{class:"editor-row"});s&&l.append(T("span",{class:"fixed-prefix"},s)),l.append(r),n.append(l)}this.renderCaseControls(e)}renderCaseControls(e){var l;const t=Va(e,this.doc);if(!t)return;const n=((l=$(this.doc,t))==null?void 0:l.cases)??[],i=Ra(e,t),s=T("div",{class:"case-controls"});if(i!==void 0&&n[i]){const m=T("input",{placeholder:d("web_case_name_placeholder"),spellcheck:"false",autocomplete:"off"});m.value=n[i].name,this.liveEdit(m,u=>u.trim()===""?void 0:La(this.doc,t,i,u)),s.append(T("label",{},d("web_case_name"),m))}const r=T("button",{},`+ ${d("inspector_add_case")}`);r.addEventListener("click",()=>{const m=Na(this.doc,t);this.commit(m.doc,m.path)});const o=T("button",{class:"danger-text"},`- ${d("inspector_remove_case")}`);o.disabled=n.length<=2||i===void 0,o.addEventListener("click",()=>{if(i===void 0)return;const m=Ea(this.doc,t,i);this.commit(m.doc,m.path)}),s.append(T("div",{class:"group"},r,o)),this.inspector.append(s)}liveEdit(e,t){let n;e.addEventListener("focus",()=>n=this.doc),e.addEventListener("input",()=>{const i=Sn(e.value);if(i!==e.value){const r=e.selectionStart;e.value=i,e.setSelectionRange(r,r)}const s=t(i);s&&(this.doc=s,this.dirty=!0,this.renderDiagramOnly())}),e.addEventListener("blur",()=>{n&&n!==this.doc&&this.pushUndo(n),n=void 0,this.renderDiagramOnly()})}renderDiagramOnly(){const e=this.selected,t=this.inspector,n=document.createElement("aside");this.inspector=n,this.render(),this.inspector=t,this.selected=e}setSimulating(e){e!==this.simulating&&(document.activeElement instanceof HTMLElement&&document.activeElement.blur(),this.endDrag(),this.simulating=e,this.root.classList.toggle("simulating",e),this.simButton.setAttribute("aria-pressed",String(e)),this.simButton.textContent=e?`✎ ${d("action_diagram")}`:`▶︎ ${d("action_simulation")}`,this.simButton.title=d(e?"web_simulation_end_title":"web_simulation_start_title"),e?(this.setCoding(!1),this.sim.begin()):(this.sim.end(),this.simPath=void 0,!this.selected&&this.doc.elements.length>0&&(this.selected=[0])),this.render())}setCoding(e){e!==this.coding&&(e&&this.setLiveCoding(!1),this.coding=e,this.root.classList.toggle("coding",e),this.codeButton.setAttribute("aria-pressed",String(e)),e?this.code.refresh():this.code.close(),this.renderDiagramOnly())}setLiveCoding(e){var t;e&&this.coding&&this.setCoding(!1),this.liveCoding=e,this.shell.classList.toggle("live",e),(t=this.liveButton)==null||t.setAttribute("aria-pressed",String(e)),Je(bn,e?"1":"0"),this.canvasHost&&this.render()}learnResizer(){return this.panelResizer(this.learn.element,"learn-resizer",X3,d("web_learn_resize"),1)}liveResizer(){return this.panelResizer(this.live.element,"live-resizer",J3,d("web_live_resize"),-1)}panelResizer(e,t,n,i,s){const r=T("div",{class:t,role:"separator","aria-orientation":"vertical",tabindex:"0",title:i}),o=(u,c)=>{e.style.width=u===void 0?"":`${fn(u)}px`,c&&Je(n,u===void 0?"":String(fn(u)))},l=Number(Xe(n));l>0&&o(l,!1);const m=()=>getComputedStyle(this.shell).direction==="rtl"?-s:s;return r.addEventListener("pointerdown",u=>{if(u.button!==0)return;u.preventDefault(),r.setPointerCapture(u.pointerId);const c=u.clientX,h=e.getBoundingClientRect().width,p=m();this.shell.classList.add("resizing");const x=I=>o(h+p*(I.clientX-c),!1),y=I=>{r.removeEventListener("pointermove",x),r.removeEventListener("pointerup",y),r.removeEventListener("pointercancel",y),this.shell.classList.remove("resizing"),o(h+p*(I.clientX-c),!0)};r.addEventListener("pointermove",x),r.addEventListener("pointerup",y),r.addEventListener("pointercancel",y)}),r.addEventListener("dblclick",()=>o(void 0,!0)),r.addEventListener("keydown",u=>{const c=u.key==="ArrowRight"?20:u.key==="ArrowLeft"?-20:0;c&&(u.preventDefault(),o(e.getBoundingClientRect().width+m()*c,!0))}),r}findSubprogram(e,t=this.tab){const n=B1(e);if(n==="")return;const i=this.tabs.find(s=>s!==t&&(B1(s.doc.caption)===n||B1(fe(s))===n));return i==null?void 0:i.doc}scrollToSimPath(){const e=this.simPath;if(!this.simulating||!e)return;const t=this.flat.find(o=>V1(o.idPath,e));if(!t)return;const n=this.canvasHost,i=this.zoom,s={x:t.frame.x*i,y:t.frame.y*i,width:t.frame.width*i,height:t.frame.height*i},r=24;s.yn.scrollTop+n.clientHeight&&(n.scrollTop=s.y-r),(s.xn.scrollLeft+n.clientWidth-r)&&(n.scrollLeft=Math.max(0,s.x-r))}commit(e,t){this.pushUndo(this.doc),this.doc=e,this.dirty=!0,t&&(this.selected=t),this.render()}pushUndo(e){for(this.undoStack.push(e);this.undoStack.length>q3;)this.undoStack.shift();this.tab.redoStack=[]}undo(){const e=this.undoStack.pop();e&&(this.redoStack.push(this.doc),this.doc=e,this.dirty=!0,this.selected=yt(this.selected,this.doc),this.render())}redo(){const e=this.redoStack.pop();e&&(this.undoStack.push(this.doc),this.doc=e,this.dirty=!0,this.selected=yt(this.selected,this.doc),this.render())}resetHistory(){this.setSimulating(!1),this.tab.undoStack=[],this.tab.redoStack=[],this.selected=void 0,this.dirty=!1,this.render()}makeTab(){return{doc:Wa(),serial:this.nextTabSerial++,dirty:!1,undoStack:[],redoStack:[],selected:[0]}}addTab(e=this.makeTab()){this.setSimulating(!1),this.tabs.push(e),this.tabIndex=this.tabs.length-1,this.render()}switchTab(e){e===this.tabIndex||!this.tabs[e]||(document.activeElement instanceof HTMLElement&&document.activeElement.blur(),this.setSimulating(!1),this.tabIndex=e,this.render())}async closeTab(e){if(this.tabs.length<=1)return;const t=this.tabs[e];t.dirty&&!t.exerciseId&&(this.switchTab(e),!await this.confirmDiscard())||(this.setSimulating(!1),this.tabs.splice(e,1),(this.tabIndex>e||this.tabIndex>=this.tabs.length)&&(this.tabIndex=Math.max(0,this.tabIndex-1)),this.render())}renderTabs(){const e=this.tabStrip;e.replaceChildren(),this.tabs.forEach((n,i)=>{const s=document.createElement("div");s.className="tab"+(i===this.tabIndex?" active":""),s.setAttribute("role","tab"),s.setAttribute("aria-selected",String(i===this.tabIndex));const r=document.createElement("button");if(r.className="tab-label",r.textContent=(n.dirty?"• ":"")+fe(n),r.title=n.fileName??fe(n),r.addEventListener("click",()=>this.switchTab(i)),s.append(r),this.tabs.length>1){const o=document.createElement("button");o.className="tab-close",o.textContent="✕",o.title=d("a11y_close_tab"),o.setAttribute("aria-label",`${d("a11y_close_tab")}: ${fe(n)}`),o.addEventListener("click",()=>this.closeTab(i)),s.append(o)}e.append(s)});const t=document.createElement("button");t.className="tab-add",t.textContent="+",t.title=d("a11y_new_diagram_tab"),t.setAttribute("aria-label",d("a11y_new_diagram_tab")),t.addEventListener("click",()=>this.addTab()),e.append(t)}copySelection(){const e=this.selected&&$(this.doc,this.selected);return e?(this.clipboard=structuredClone(e),this.showMessage(d("web_copied")),!0):!1}cutSelection(){this.selected&&S1(this.doc,this.selected)&&this.copySelection()&&this.deleteSelection()}paste(){this.clipboard&&this.insertNearSelection(structuredClone(this.clipboard))}deleteSelection(){!this.selected||!S1(this.doc,this.selected)||(this.commit(De(this.doc,this.selected)),this.selected=void 0,this.render())}insertNearSelection(e){const t=this.selected;if(t&&ve(this.doc,t))return this.commit(ge(this.doc,t,e),t);if(t){const n=[...t.slice(0,-1),t[t.length-1]+1];return this.commit(G1(this.doc,e,t),n)}if(this.doc.elements.length===1&&ve(this.doc,[0]))return this.commit(ge(this.doc,[0],e),[0]);this.commit(_e(this.doc,[],this.doc.elements.length,e),[this.doc.elements.length])}confirmDiscard(){return this.dirty?new Promise(e=>{const t=document.createElement("div");t.className="confirm",t.innerHTML=`
+`))});const l=T("div",{class:"editor-row"});s&&l.append(T("span",{class:"fixed-prefix"},s)),l.append(r),n.append(l)}this.renderCaseControls(e)}renderCaseControls(e){var l;const t=Va(e,this.doc);if(!t)return;const n=((l=$(this.doc,t))==null?void 0:l.cases)??[],i=Ra(e,t),s=T("div",{class:"case-controls"});if(i!==void 0&&n[i]){const m=T("input",{placeholder:d("web_case_name_placeholder"),spellcheck:"false",autocomplete:"off"});m.value=n[i].name,this.liveEdit(m,u=>u.trim()===""?void 0:La(this.doc,t,i,u)),s.append(T("label",{},d("web_case_name"),m))}const r=T("button",{},`+ ${d("inspector_add_case")}`);r.addEventListener("click",()=>{const m=Na(this.doc,t);this.commit(m.doc,m.path)});const o=T("button",{class:"danger-text"},`- ${d("inspector_remove_case")}`);o.disabled=n.length<=2||i===void 0,o.addEventListener("click",()=>{if(i===void 0)return;const m=Ea(this.doc,t,i);this.commit(m.doc,m.path)}),s.append(T("div",{class:"group"},r,o)),this.inspector.append(s)}liveEdit(e,t){let n;e.addEventListener("focus",()=>n=this.doc),e.addEventListener("input",()=>{const i=Sn(e.value);if(i!==e.value){const r=e.selectionStart;e.value=i,e.setSelectionRange(r,r)}const s=t(i);s&&(this.doc=s,this.dirty=!0,this.renderDiagramOnly())}),e.addEventListener("blur",()=>{n&&n!==this.doc&&this.pushUndo(n),n=void 0,this.renderDiagramOnly()})}renderDiagramOnly(){const e=this.selected,t=this.inspector,n=document.createElement("aside");this.inspector=n,this.render(),this.inspector=t,this.selected=e}setSimulating(e){e!==this.simulating&&(document.activeElement instanceof HTMLElement&&document.activeElement.blur(),this.endDrag(),this.simulating=e,this.root.classList.toggle("simulating",e),this.simButton.setAttribute("aria-pressed",String(e)),this.simButton.textContent=e?`✎ ${d("action_diagram")}`:`▶︎ ${d("action_simulation")}`,this.simButton.title=d(e?"web_simulation_end_title":"web_simulation_start_title"),e?(this.setCoding(!1),this.sim.begin()):(this.sim.end(),this.simPath=void 0,!this.selected&&this.doc.elements.length>0&&(this.selected=[0])),this.render())}setCoding(e){e!==this.coding&&(e&&this.setLiveCoding(!1),this.coding=e,this.root.classList.toggle("coding",e),this.codeButton.setAttribute("aria-pressed",String(e)),e?this.code.refresh():this.code.close(),this.renderDiagramOnly())}setLiveCoding(e){e&&this.coding&&this.setCoding(!1),this.liveCoding=e,this.shell.classList.toggle("live",e),Je(bn,e?"1":"0"),this.canvasHost&&this.render()}learnResizer(){return this.panelResizer(this.learn.element,"learn-resizer",X3,d("web_learn_resize"),1)}liveResizer(){return this.panelResizer(this.live.element,"live-resizer",J3,d("web_live_resize"),-1)}panelResizer(e,t,n,i,s){const r=T("div",{class:t,role:"separator","aria-orientation":"vertical",tabindex:"0",title:i}),o=(u,c)=>{e.style.width=u===void 0?"":`${fn(u)}px`,c&&Je(n,u===void 0?"":String(fn(u)))},l=Number(Xe(n));l>0&&o(l,!1);const m=()=>getComputedStyle(this.shell).direction==="rtl"?-s:s;return r.addEventListener("pointerdown",u=>{if(u.button!==0)return;u.preventDefault(),r.setPointerCapture(u.pointerId);const c=u.clientX,h=e.getBoundingClientRect().width,p=m();this.shell.classList.add("resizing");const x=I=>o(h+p*(I.clientX-c),!1),f=I=>{r.removeEventListener("pointermove",x),r.removeEventListener("pointerup",f),r.removeEventListener("pointercancel",f),this.shell.classList.remove("resizing"),o(h+p*(I.clientX-c),!0)};r.addEventListener("pointermove",x),r.addEventListener("pointerup",f),r.addEventListener("pointercancel",f)}),r.addEventListener("dblclick",()=>o(void 0,!0)),r.addEventListener("keydown",u=>{const c=u.key==="ArrowRight"?20:u.key==="ArrowLeft"?-20:0;c&&(u.preventDefault(),o(e.getBoundingClientRect().width+m()*c,!0))}),r}findSubprogram(e,t=this.tab){const n=B1(e);if(n==="")return;const i=this.tabs.find(s=>s!==t&&(B1(s.doc.caption)===n||B1(fe(s))===n));return i==null?void 0:i.doc}scrollToSimPath(){const e=this.simPath;if(!this.simulating||!e)return;const t=this.flat.find(o=>V1(o.idPath,e));if(!t)return;const n=this.canvasHost,i=this.zoom,s={x:t.frame.x*i,y:t.frame.y*i,width:t.frame.width*i,height:t.frame.height*i},r=24;s.yn.scrollTop+n.clientHeight&&(n.scrollTop=s.y-r),(s.xn.scrollLeft+n.clientWidth-r)&&(n.scrollLeft=Math.max(0,s.x-r))}commit(e,t){this.pushUndo(this.doc),this.doc=e,this.dirty=!0,t&&(this.selected=t),this.render()}pushUndo(e){for(this.undoStack.push(e);this.undoStack.length>q3;)this.undoStack.shift();this.tab.redoStack=[]}undo(){const e=this.undoStack.pop();e&&(this.redoStack.push(this.doc),this.doc=e,this.dirty=!0,this.selected=yt(this.selected,this.doc),this.render())}redo(){const e=this.redoStack.pop();e&&(this.undoStack.push(this.doc),this.doc=e,this.dirty=!0,this.selected=yt(this.selected,this.doc),this.render())}resetHistory(){this.setSimulating(!1),this.tab.undoStack=[],this.tab.redoStack=[],this.selected=void 0,this.dirty=!1,this.render()}makeTab(){return{doc:Wa(),serial:this.nextTabSerial++,dirty:!1,undoStack:[],redoStack:[],selected:[0]}}addTab(e=this.makeTab()){this.setSimulating(!1),this.tabs.push(e),this.tabIndex=this.tabs.length-1,this.render()}switchTab(e){e===this.tabIndex||!this.tabs[e]||(document.activeElement instanceof HTMLElement&&document.activeElement.blur(),this.setSimulating(!1),this.tabIndex=e,this.render())}async closeTab(e){if(this.tabs.length<=1)return;const t=this.tabs[e];t.dirty&&!t.exerciseId&&(this.switchTab(e),!await this.confirmDiscard())||(this.setSimulating(!1),this.tabs.splice(e,1),(this.tabIndex>e||this.tabIndex>=this.tabs.length)&&(this.tabIndex=Math.max(0,this.tabIndex-1)),this.render())}renderTabs(){const e=this.tabStrip;e.replaceChildren(),this.tabs.forEach((n,i)=>{const s=document.createElement("div");s.className="tab"+(i===this.tabIndex?" active":""),s.setAttribute("role","tab"),s.setAttribute("aria-selected",String(i===this.tabIndex));const r=document.createElement("button");if(r.className="tab-label",r.textContent=(n.dirty?"• ":"")+fe(n),r.title=n.fileName??fe(n),r.addEventListener("click",()=>this.switchTab(i)),s.append(r),this.tabs.length>1){const o=document.createElement("button");o.className="tab-close",o.textContent="✕",o.title=d("a11y_close_tab"),o.setAttribute("aria-label",`${d("a11y_close_tab")}: ${fe(n)}`),o.addEventListener("click",()=>this.closeTab(i)),s.append(o)}e.append(s)});const t=document.createElement("button");t.className="tab-add",t.textContent="+",t.title=d("a11y_new_diagram_tab"),t.setAttribute("aria-label",d("a11y_new_diagram_tab")),t.addEventListener("click",()=>this.addTab()),e.append(t)}copySelection(){const e=this.selected&&$(this.doc,this.selected);return e?(this.clipboard=structuredClone(e),this.showMessage(d("web_copied")),!0):!1}cutSelection(){this.selected&&S1(this.doc,this.selected)&&this.copySelection()&&this.deleteSelection()}paste(){this.clipboard&&this.insertNearSelection(structuredClone(this.clipboard))}deleteSelection(){!this.selected||!S1(this.doc,this.selected)||(this.commit(De(this.doc,this.selected)),this.selected=void 0,this.render())}insertNearSelection(e){const t=this.selected;if(t&&ve(this.doc,t))return this.commit(ge(this.doc,t,e),t);if(t){const n=[...t.slice(0,-1),t[t.length-1]+1];return this.commit(G1(this.doc,e,t),n)}if(this.doc.elements.length===1&&ve(this.doc,[0]))return this.commit(ge(this.doc,[0],e),[0]);this.commit(_e(this.doc,[],this.doc.elements.length,e),[this.doc.elements.length])}confirmDiscard(){return this.dirty?new Promise(e=>{const t=document.createElement("div");t.className="confirm",t.innerHTML=`

${k(d("close_unsaved_title"))}

${k(d("web_discard_message_fmt",this.fileName))}

diff --git a/website/app/assets/index-H9tqnCHk.css b/website/app/assets/index-CWMWwjGt.css similarity index 55% rename from website/app/assets/index-H9tqnCHk.css rename to website/app/assets/index-CWMWwjGt.css index 09049e19..846f9545 100644 --- a/website/app/assets/index-H9tqnCHk.css +++ b/website/app/assets/index-CWMWwjGt.css @@ -1 +1 @@ -:root{--bg: #f2f2f7;--panel: #ffffff;--text: #1c1c1e;--muted: #6e6e73;--border: #d1d1d6;--accent: #007aff;--accent-soft: rgba(0, 122, 255, .18);color-scheme:light}*{box-sizing:border-box}html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:14px/1.4 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.app{display:grid;grid-template:"bar bar" auto "pal work" 1fr "pal insp" auto "status status" auto / 210px minmax(0,1fr);height:100%;flex:1;min-width:0}.shell{display:flex;height:100vh;height:100dvh}.toolbar{grid-area:bar;display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;padding:8px 12px;background:var(--panel);border-bottom:1px solid var(--border)}.brand{font-weight:700;font-size:16px;display:flex;align-items:center;gap:8px;margin-inline-end:auto}.brand small{font-weight:500;color:var(--muted);font-size:12px}.logo{width:20px;height:20px;border:2px solid currentColor;background:linear-gradient(to bottom right,transparent 47%,currentColor 47% 53%,transparent 53%) left / 50% 60% no-repeat,linear-gradient(to bottom left,transparent 47%,currentColor 47% 53%,transparent 53%) right / 50% 60% no-repeat}.group{display:flex;flex-wrap:wrap;gap:6px}button,select{font:inherit;padding:6px 12px;border:1px solid var(--border);border-radius:8px;background:var(--panel);color:var(--text);cursor:pointer;min-height:34px}select{max-width:180px}button:hover:not(:disabled),select:hover{border-color:var(--accent)}button:disabled{opacity:.4;cursor:default}.palette,.inspector{background:var(--panel);padding:12px;overflow-y:auto}.palette{grid-area:pal;border-inline-end:1px solid var(--border)}.inspector{grid-area:insp;border-top:1px solid var(--border);max-height:34vh}h2{font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:0 0 4px}.hint{color:var(--muted);font-size:12px;margin:0 0 10px}.palette ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}.palette-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;cursor:grab;line-height:1.25;user-select:none;-webkit-user-select:none;touch-action:none}.palette-item:hover,.palette-item:focus-visible{border-color:var(--accent);outline:none}.palette-item .icon{flex:none;color:var(--text)}.workspace{grid-area:work;display:flex;flex-direction:column;min-width:0;min-height:0}.caption{font:600 18px system-ui,-apple-system,sans-serif;border:none;border-bottom:1px solid var(--border);padding:10px 16px;background:var(--panel);outline:none}.canvas{flex:1;overflow:auto;scrollbar-gutter:stable;background:#fafafa}.canvas svg{display:block;user-select:none;-webkit-user-select:none}.dragging,.dragging *{cursor:grabbing!important}.drop-line{fill:var(--accent)}.drop-replace{fill:var(--accent-soft);stroke:var(--accent);stroke-width:3}.drag-ghost{position:fixed;left:0;top:0;z-index:10;pointer-events:none;padding:6px 10px;border-radius:8px;background:var(--accent);color:#fff;font-weight:600;box-shadow:0 4px 14px #0003;white-space:nowrap;max-width:260px;overflow:hidden;text-overflow:ellipsis}.inspector label{display:block;font-weight:600;margin:8px 0 4px}.inspector textarea{width:100%;font:14px ui-monospace,SF Mono,Menlo,Consolas,monospace;padding:8px;border:1px solid var(--border);border-radius:8px;resize:vertical}.statusbar{grid-area:status;display:flex;flex-wrap:wrap;gap:2px 16px;align-items:baseline;padding:4px 12px;font-size:12px;color:var(--muted);background:var(--panel);border-top:1px solid var(--border)}.status{flex:1 1 auto;min-width:0}.site-links{display:flex;gap:12px;margin-inline-start:auto}.site-links a{color:inherit}.site-links a:hover,.site-links a:focus-visible{color:var(--accent)}a.brand{color:inherit;text-decoration:none}.file-drag .canvas{outline:3px dashed var(--accent);outline-offset:-8px}@media(max-width:820px){.app{grid-template:"bar" auto "pal" auto "work" 1fr "insp" auto "status" auto / minmax(0,1fr)}.palette,.inspector{min-width:0}.palette{border-inline-end:none;border-bottom:1px solid var(--border);padding:8px}.palette .hint,.palette h2{display:none}.palette ul{display:flex;overflow-x:auto;overflow-y:hidden}.palette-item{white-space:nowrap}.inspector{max-height:30vh}}.status.message{color:var(--text);font-weight:600}.confirm{position:fixed;top:0;right:0;bottom:0;left:0;z-index:20;display:grid;place-items:center;background:#00000040;padding:16px}.confirm-card{background:var(--panel);border-radius:12px;padding:16px 18px;max-width:360px;box-shadow:0 10px 30px #0003}.confirm-card p{margin:0 0 8px}.confirm-card .group{justify-content:flex-end;margin-top:12px}button.danger{background:#d70015;border-color:#d70015;color:#fff}.simpanel{display:none;grid-area:insp;background:var(--panel);border-inline-start:1px solid var(--border);padding:12px;overflow-y:auto}.app.simulating{grid-template:"bar bar" auto "work insp" 1fr "status status" auto / minmax(0,1fr) 320px}.app.simulating .palette,.app.simulating .inspector{display:none}.app.simulating .simpanel{display:block}.app.simulating .caption{cursor:default}button.sim-toggle{font-weight:600}button.sim-toggle[aria-pressed=false]{background:var(--accent);border-color:var(--accent);color:#fff}.simpanel section{margin-bottom:14px}.sim-buttons{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:6px 0 10px}.sim-option{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:13px}.mono,.sim-vars td{font:13px/1.5 ui-monospace,SF Mono,Menlo,Consolas,monospace}.sim-trace,.sim-output,.sim-vars{background:var(--bg);border-radius:8px;padding:8px 10px;overflow-wrap:anywhere}.sim-output{max-height:220px;overflow-y:auto;white-space:pre-wrap}.sim-vars table{border-collapse:collapse;width:100%}.sim-vars td{padding:2px 0;vertical-align:top}.sim-vars td:first-child{color:var(--muted);padding-inline-end:12px;width:1%;white-space:nowrap}.sim-vars table.sim-grid{width:auto}.sim-vars .sim-grid td,.sim-vars .sim-grid td:first-child{border:1px solid var(--border);color:inherit;font-size:11px;padding:0 4px;text-align:center;width:auto}.sim-vars .sim-grid td.sim-grid-true{font-weight:700}.simpanel .placeholder{color:var(--muted);font:13px system-ui,-apple-system,sans-serif;margin:0}.sim-notice{margin:0 0 14px;padding:8px 10px;border-radius:8px;background:#34c75926;font-weight:600}.sim-edit{width:100%;margin:-6px 0 14px}.sim-notice.error{background:#ff3b3026;color:#b0000f}.sim-input.active{padding:8px 10px;margin-left:-10px;margin-right:-10px;border-radius:10px;background:#007aff14;outline:2px solid var(--accent)}.sim-prompt{margin:4px 0 6px;font-weight:600}.sim-input-row{display:flex;gap:6px}.sim-input-row input{flex:1;min-width:0;font:inherit;padding:6px 10px;border:1px solid var(--border);border-radius:8px}.sim-input-error{color:#b0000f;margin:6px 0 0;font-size:13px}@media(max-width:820px){.app.simulating{grid-template:"bar" auto "work" minmax(200px,1fr) "insp" auto "status" auto / minmax(0,1fr)}.simpanel{border-inline-start:none;border-top:1px solid var(--border);max-height:48vh}}.codepanel{display:none;grid-area:code;background:var(--panel);border-inline-start:1px solid var(--border);padding:12px;overflow-y:auto;min-height:0}.app.coding{grid-template:"bar bar bar" auto "pal work code" 1fr "pal insp code" auto "status status status" auto / 210px minmax(0,1fr) 400px}.app.coding .codepanel{display:block}.app.coding .inspector{max-height:34vh}button[data-action=code][aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft)}.code-head,.runner-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.code-close{min-height:28px;padding:2px 10px}.segmented{display:flex;margin-bottom:8px}.segmented button{flex:1;border-radius:0;min-height:30px;padding:4px 8px}.segmented button:first-child{border-radius:8px 0 0 8px}.segmented button:last-child{border-radius:0 8px 8px 0}.segmented button+button{border-inline-start:none}.segmented button[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:#fff}.segmented[hidden]{display:none}.check{display:flex;gap:8px;align-items:center;font-size:13px;margin-bottom:4px}.code-actions{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}.code-actions [hidden]{display:none}button.primary{background:var(--accent);border-color:var(--accent);color:#fff}.code-view,.runner-out{margin:0;padding:10px 12px;border-radius:10px;background:var(--bg);font:13px/1.5 ui-monospace,SF Mono,Menlo,Consolas,monospace;overflow:auto;white-space:pre;-moz-tab-size:4;tab-size:4}.runner{margin:12px 0}.runner-out{background:#0b1220;color:#e5e7eb;min-height:3em;max-height:240px;white-space:pre-wrap}.runner-out.error{outline:2px solid #ff453a}.runner-input{margin-top:8px}.runner-input label{display:block;font-weight:600;margin-bottom:4px}@media(max-width:820px){.app.coding{grid-template:"bar" auto "pal" auto "work" minmax(240px,1fr) "insp" auto "code" auto "status" auto / minmax(0,1fr)}.codepanel{border-inline-start:none;border-top:1px solid var(--border);max-height:50vh}}.tabs{display:flex;align-items:flex-end;gap:2px;padding:6px 8px 0;background:var(--bg);border-bottom:1px solid var(--border);overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}.tab{display:flex;align-items:center;max-width:220px;border:1px solid var(--border);border-bottom:none;border-radius:8px 8px 0 0;background:#ffffff80}.tab.active{background:var(--panel);margin-bottom:-1px;padding-bottom:1px}.tab button{border:none;background:none;min-height:30px;border-radius:8px 8px 0 0}.tab-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:4px 6px 4px 12px}.tab.active .tab-label{font-weight:600}.tab-close{padding:2px 8px;color:var(--muted);font-size:11px}.tab-close:hover{color:var(--text)}.tab-add{min-height:28px;padding:2px 10px;margin:0 0 3px 4px;border-radius:8px}.inspector .segmented{margin:6px 0 4px;max-width:420px}.mono-hint{font:11px/1.45 ui-monospace,SF Mono,Menlo,Consolas,monospace;overflow-wrap:anywhere}.editor-row{display:flex;gap:8px;align-items:flex-start}.editor-row textarea{flex:1;min-width:0}.fixed-prefix{font:14px ui-monospace,SF Mono,Menlo,Consolas,monospace;color:var(--muted);padding-top:9px}.inspector input:not([type]){width:100%;font:14px ui-monospace,SF Mono,Menlo,Consolas,monospace;padding:7px 8px;border:1px solid var(--border);border-radius:8px}.for-fields{display:grid;gap:4px}.for-fields label,.case-controls label{margin:4px 0 0;font-size:12px;color:var(--muted);font-weight:600}.case-controls{margin-top:12px;padding-top:10px;border-top:1px solid var(--border)}.case-controls .group{margin-top:8px}button.danger-text:not(:disabled){color:#d70015}.print-sheet{display:none}.learn{display:none;flex:none;width:400px;flex-direction:column;background:var(--panel);border-inline-end:1px solid var(--border);min-height:0}.shell.learning .learn{display:flex}.learn-resizer{display:none;flex:none;width:10px;margin-inline:-5px;z-index:5;cursor:col-resize;touch-action:none;position:relative}.shell.learning .learn-resizer{display:block}.learn-resizer:after{content:"";position:absolute;inset-block:0;inset-inline-start:4px;width:2px;background:transparent;transition:background .15s}.learn-resizer:hover:after,.learn-resizer:focus-visible:after,.shell.resizing .learn-resizer:after{background:var(--accent)}.learn-resizer:focus-visible{outline:none}.shell.resizing{cursor:col-resize;-webkit-user-select:none;user-select:none}.learn-head{display:flex;align-items:flex-start;gap:6px;margin:10px 12px 0}.learn-tabs{flex:1;min-width:0}.learn-hide{flex:none;min-height:30px;padding:4px 7px;display:inline-flex;align-items:center;color:var(--muted)}.learn-rail{flex:none;display:flex;flex-direction:column;align-items:center;gap:10px;width:36px;padding:10px 0;border:none;border-radius:0;border-inline-end:1px solid var(--border);background:var(--panel);cursor:pointer}.learn-rail:hover{background:var(--accent-soft)}.learn-rail span{writing-mode:vertical-rl;white-space:nowrap}.shell.learning .learn-rail{display:none}.live-rail{border-inline-end:none;border-inline-start:1px solid var(--border)}.live-rail svg{transform:scaleX(-1)}.shell.live .live-rail{display:none}.learn-body{overflow-y:auto;scrollbar-gutter:stable;padding:4px 16px 24px;flex:1;min-height:0;line-height:1.5}.learn-body h2.learn-title{font-size:20px;text-transform:none;letter-spacing:0;color:var(--text);margin:2px 0 10px}.learn-section{font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:18px 0 6px}.learn-list{list-style:none;padding:0;margin:0;display:grid;gap:6px}.learn-item{display:flex;align-items:center;gap:10px;width:100%;text-align:start;padding:8px 10px}.learn-item.done{border-color:#34c759}.learn-num{flex:none;min-width:28px;height:28px;border-radius:14px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font-weight:700;font-size:12px;padding:0 6px}.learn-item.done .learn-num{background:#34c7592e;color:#248a3d}.learn-item-text{flex:1;display:grid;min-width:0}.learn-item-text small{color:var(--muted)}.learn-status{flex:none;color:var(--muted);font-size:12px}.learn-item.done .learn-status{color:#248a3d;font-weight:700}.learn-back,.link-button{border:none;background:none;padding:6px 0;min-height:0;color:var(--accent)}.link-button{padding:0;text-align:start}.learn-kicker{margin:4px 0 0;color:var(--muted);font-size:12px}.learn-progress{display:flex;gap:4px;margin-bottom:14px}.learn-progress button{flex:1 1 0;min-width:0;padding:3px 0;font-size:13px;font-variant-numeric:tabular-nums;border-radius:6px}.learn-progress button.past{border-color:var(--accent);color:var(--accent)}.learn-progress button.current{border-color:var(--accent);background:var(--accent);color:#fff;font-weight:600}.learn-step-title{font-size:16px;margin:0 0 6px}.learn-text p,.learn-text ul,.learn-text ol{margin:0 0 10px}.learn-text ul,.learn-text ol{padding-inline-start:22px}.learn-text code,.learn-tests code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;background:var(--bg);border-radius:4px;padding:1px 4px}.learn-text h3{font-size:15px;margin:18px 0 4px}.lesson-code{background:var(--bg);border-radius:8px;padding:8px 10px;margin:0 0 10px;overflow-x:auto;overflow-y:hidden;font-size:12.5px}.lesson-code code{background:none;padding:0}.lesson-note{border-inline-start:3px solid var(--accent);background:var(--accent-soft);border-radius:6px;padding:8px 10px;margin:0 0 10px}.lesson-note p:last-child{margin-bottom:0}.learn-images{display:flex;gap:8px;flex-wrap:wrap}.learn-images img{width:150px;height:200px;object-fit:cover;border-radius:8px}.learn-brag{display:grid;grid-template-columns:48px 1fr;gap:10px;align-items:start;border:1px solid var(--border);border-radius:10px;padding:10px 12px;margin:0 0 14px;background:var(--accent-soft)}.learn-brag img{width:48px;height:48px;border-radius:50%}.learn-brag-title{margin:0 0 4px;font-weight:700}.learn-brag .learn-text p:last-child{margin-bottom:0}.learn-figure{margin:0 0 14px;display:grid;gap:6px;justify-items:start}.learn-preview{width:100%;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:#fafafa}.learn-preview>svg{display:block;width:100%;margin:0 auto;height:auto}.learn-figure figcaption{color:var(--muted);font-size:13px}.learn-exercise{border:1px solid var(--accent);border-radius:10px;padding:10px 12px;margin:0 0 14px;display:grid;gap:8px}.learn-exercise h4{margin:0;font-size:15px;display:flex;gap:8px;align-items:center}.learn-badge{font-size:12px;color:#248a3d;background:#34c7592e;border-radius:10px;padding:1px 8px}.learn-exercise .learn-text p:last-child{margin-bottom:0}.learn-result:empty{display:none}.learn-result{border-radius:8px;padding:8px 10px}.learn-result.ok{background:#34c75924}.learn-result.fail{background:#ff950024}.learn-result.info{background:var(--bg)}.learn-result-head{margin:0 0 6px;font-weight:600}.learn-tests{list-style:none;padding:0;margin:0;display:grid;gap:6px}.learn-test-detail{display:grid;padding-inline-start:16px;font-size:13px}.learn-error{color:#c4291c}.learn-solution summary{cursor:pointer;color:var(--accent)}.learn-solution[open]{display:grid;gap:6px;justify-items:start}.learn-checklist{list-style:none;padding:0;margin:0 0 14px;display:grid;gap:6px}.learn-checklist li{display:flex;gap:8px;align-items:baseline;justify-content:space-between}.learn-checklist label{display:flex;gap:8px;align-items:baseline}.learn-return{width:100%;margin:0 0 12px;border-color:var(--accent);background:var(--accent-soft)}.learn-nav+.learn-return{margin:12px 0 0}.learn-check-link{flex:none;font-size:13px}.learn-quiz fieldset{border:1px solid var(--border);border-radius:10px;padding:8px 12px 10px;margin:0 0 10px;display:grid;gap:6px}.learn-quiz legend{font-weight:600;padding:0 4px}.learn-option{text-align:start}.learn-option.right{border-color:#34c759;background:#34c75924}.learn-option.wrong{border-color:#ff3b30;background:#ff3b301a}.learn-match{display:grid;gap:6px}.learn-match-left{display:grid;grid-template-columns:8.5em minmax(0,1fr);align-items:center;gap:8px}.learn-match-select{min-width:0;width:100%;max-width:none}.learn-match-select.right{border-color:#34c759;background:#34c75924}.learn-match-select.wrong{border-color:#ff3b30;background:#ff3b301a}.learn-explanation{margin:0;color:var(--muted);font-size:13px}.learn-score{font-weight:600}.learn-nav{display:flex;justify-content:space-between;gap:8px;margin-top:18px}button[data-action=learn][aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft)}@media(max-width:1100px){.learn{width:340px}}@media(max-width:900px){.learn{width:300px}}.livecode{display:none;flex:none;width:420px;flex-direction:column;gap:6px;padding:10px 12px 12px;background:var(--panel);border-inline-start:1px solid var(--border);min-height:0}.shell.live .livecode{display:flex}.livecode-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px}.livecode-head h2{margin:0;font-size:16px}.livecode-head .segmented{margin:0 0 0 auto}.livecode-head .segmented button{min-height:28px;padding:2px 10px}.livecode .learn-hide svg{transform:scaleX(-1)}.livecode .hint{margin:0}.livecode-view{flex:1;min-height:0;padding:10px 0;font-size:14px}.livecode-view .ln{padding:0 12px;min-height:1.5em;border-inline-start:3px solid transparent}.livecode-view.selectable .ln{cursor:pointer}.livecode-view .ln.sel{background:var(--accent-soft);border-inline-start-color:var(--accent)}.livecode-view .ph{color:var(--muted);font-style:italic}.live-resizer{display:none;flex:none;width:10px;margin-inline:-5px;z-index:5;cursor:col-resize;touch-action:none;position:relative}.shell.live .live-resizer{display:block}.live-resizer:after{content:"";position:absolute;inset-block:0;inset-inline-start:4px;width:2px;background:transparent;transition:background .15s}.live-resizer:hover:after,.live-resizer:focus-visible:after,.shell.resizing .live-resizer:after{background:var(--accent)}.live-resizer:focus-visible{outline:none}button[data-action=live][aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft)}@media(max-width:1100px){.livecode{width:340px}}@media(max-width:700px){.shell.learning .learn-resizer,.shell.live .live-resizer{display:none}.shell .learn,.shell .livecode{width:auto!important}.livecode{height:40vh;height:40dvh;border-inline-start:none;border-top:1px solid var(--border)}.learn-rail{flex-direction:row;justify-content:center;width:auto;padding:4px 0;border-inline-end:none;border-bottom:1px solid var(--border)}.learn-rail span{writing-mode:horizontal-tb}.live-rail{border-inline-start:none;border-bottom:none;border-top:1px solid var(--border)}.shell{flex-direction:column}.learn{width:auto;height:45vh;height:45dvh;border-inline-end:none;border-bottom:1px solid var(--border)}.shell>.app{flex:1;min-height:0}}@media print{@page{margin:12mm}body>*:not(.print-sheet){display:none!important}body{background:#fff!important}.print-sheet{display:block}.print-sheet svg{display:block;width:100%;height:auto;max-height:100vh}}.learn .term{text-decoration:underline dotted var(--accent);text-decoration-thickness:2px;text-underline-offset:3px;cursor:help;border-radius:3px}.learn .term:focus-visible,.learn .term[aria-expanded=true]{outline:none;background:var(--accent-soft)}.term-tip{position:fixed;z-index:1000;max-width:min(300px,calc(100vw - 16px));padding:8px 10px;background:var(--panel);color:var(--text);border:1px solid var(--border);border-radius:8px;box-shadow:0 4px 16px #0000002e;font-size:14px;line-height:1.4}.term-tip[hidden]{display:none}.learn .ui-pointer{color:var(--accent);font-weight:600;border-bottom:2px solid var(--accent-soft);cursor:pointer;border-radius:3px}.learn .ui-pointer:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.ui-spot{outline:3px solid var(--accent)!important;outline-offset:-3px;box-shadow:inset 0 0 0 9999px #007aff14;animation:ui-spot-pulse 1.2s ease-in-out infinite}@keyframes ui-spot-pulse{50%{outline-color:#007aff59}}@media(prefers-reduced-motion:reduce){.ui-spot{animation:none}}.learn-graphic{display:block;width:100%;max-width:440px;height:auto;margin:0 auto;border-radius:8px;border:1px solid var(--border)}.lesson-table{overflow-x:auto;margin:8px 0}.lesson-table table{border-collapse:collapse;font-size:13px;font-variant-numeric:tabular-nums}.lesson-table th,.lesson-table td{border:1px solid var(--border);padding:3px 8px;text-align:start;white-space:nowrap}.lesson-table th{background:var(--bg)}.learn-hints .lesson-note{margin-top:8px}.learn-teacher{margin-top:24px;border-top:1px solid var(--border);padding-top:12px}.learn-teacher summary{cursor:pointer;color:var(--muted)}.learn-teacher input{flex:1;min-width:0} +:root{--bg: #f2f2f7;--panel: #ffffff;--text: #1c1c1e;--muted: #6e6e73;--border: #d1d1d6;--accent: #007aff;--accent-soft: rgba(0, 122, 255, .18);color-scheme:light}*{box-sizing:border-box}html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:14px/1.4 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.app{display:grid;grid-template:"bar bar" auto "pal work" 1fr "pal insp" auto "status status" auto / 210px minmax(0,1fr);height:100%;flex:1;min-width:0}.shell{display:flex;height:100vh;height:100dvh}.toolbar{grid-area:bar;display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;padding:8px 12px;background:var(--panel);border-bottom:1px solid var(--border)}.brand{font-weight:700;font-size:16px;display:flex;align-items:center;gap:8px;margin-inline-end:auto}.brand small{font-weight:500;color:var(--muted);font-size:12px}.logo{width:20px;height:20px;border:2px solid currentColor;background:linear-gradient(to bottom right,transparent 47%,currentColor 47% 53%,transparent 53%) left / 50% 60% no-repeat,linear-gradient(to bottom left,transparent 47%,currentColor 47% 53%,transparent 53%) right / 50% 60% no-repeat}.group{display:flex;flex-wrap:wrap;gap:6px}button,select{font:inherit;padding:6px 12px;border:1px solid var(--border);border-radius:8px;background:var(--panel);color:var(--text);cursor:pointer;min-height:34px}select{max-width:180px}button:hover:not(:disabled),select:hover{border-color:var(--accent)}button:disabled{opacity:.4;cursor:default}.palette,.inspector{background:var(--panel);padding:12px;overflow-y:auto}.palette{grid-area:pal;border-inline-end:1px solid var(--border)}.inspector{grid-area:insp;border-top:1px solid var(--border);max-height:34vh}h2{font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:0 0 4px}.hint{color:var(--muted);font-size:12px;margin:0 0 10px}.palette ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}.palette-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;cursor:grab;line-height:1.25;user-select:none;-webkit-user-select:none;touch-action:none}.palette-item:hover,.palette-item:focus-visible{border-color:var(--accent);outline:none}.palette-item .icon{flex:none;color:var(--text)}.workspace{grid-area:work;display:flex;flex-direction:column;min-width:0;min-height:0}.caption{font:600 18px system-ui,-apple-system,sans-serif;border:none;border-bottom:1px solid var(--border);padding:10px 16px;background:var(--panel);outline:none}.canvas{flex:1;overflow:auto;scrollbar-gutter:stable;background:#fafafa}.canvas svg{display:block;user-select:none;-webkit-user-select:none}.dragging,.dragging *{cursor:grabbing!important}.drop-line{fill:var(--accent)}.drop-replace{fill:var(--accent-soft);stroke:var(--accent);stroke-width:3}.drag-ghost{position:fixed;left:0;top:0;z-index:10;pointer-events:none;padding:6px 10px;border-radius:8px;background:var(--accent);color:#fff;font-weight:600;box-shadow:0 4px 14px #0003;white-space:nowrap;max-width:260px;overflow:hidden;text-overflow:ellipsis}.inspector label{display:block;font-weight:600;margin:8px 0 4px}.inspector textarea{width:100%;font:14px ui-monospace,SF Mono,Menlo,Consolas,monospace;padding:8px;border:1px solid var(--border);border-radius:8px;resize:vertical}.statusbar{grid-area:status;display:flex;flex-wrap:wrap;gap:2px 16px;align-items:baseline;padding:4px 12px;font-size:12px;color:var(--muted);background:var(--panel);border-top:1px solid var(--border)}.status{flex:1 1 auto;min-width:0}.site-links{display:flex;gap:12px;margin-inline-start:auto}.site-links a{color:inherit}.site-links a:hover,.site-links a:focus-visible{color:var(--accent)}a.brand{color:inherit;text-decoration:none}.file-drag .canvas{outline:3px dashed var(--accent);outline-offset:-8px}@media(max-width:820px){.app{grid-template:"bar" auto "pal" auto "work" 1fr "insp" auto "status" auto / minmax(0,1fr)}.palette,.inspector{min-width:0}.palette{border-inline-end:none;border-bottom:1px solid var(--border);padding:8px}.palette .hint,.palette h2{display:none}.palette ul{display:flex;overflow-x:auto;overflow-y:hidden}.palette-item{white-space:nowrap}.inspector{max-height:30vh}}.status.message{color:var(--text);font-weight:600}.confirm{position:fixed;top:0;right:0;bottom:0;left:0;z-index:20;display:grid;place-items:center;background:#00000040;padding:16px}.confirm-card{background:var(--panel);border-radius:12px;padding:16px 18px;max-width:360px;box-shadow:0 10px 30px #0003}.confirm-card p{margin:0 0 8px}.confirm-card .group{justify-content:flex-end;margin-top:12px}button.danger{background:#d70015;border-color:#d70015;color:#fff}.simpanel{display:none;grid-area:insp;background:var(--panel);border-inline-start:1px solid var(--border);padding:12px;overflow-y:auto}.app.simulating{grid-template:"bar bar" auto "work insp" 1fr "status status" auto / minmax(0,1fr) 320px}.app.simulating .palette,.app.simulating .inspector{display:none}.app.simulating .simpanel{display:block}.app.simulating .caption{cursor:default}button.sim-toggle{font-weight:600}button.sim-toggle[aria-pressed=false]{background:var(--accent);border-color:var(--accent);color:#fff}.simpanel section{margin-bottom:14px}.sim-buttons{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:6px 0 10px}.sim-option{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:13px}.mono,.sim-vars td{font:13px/1.5 ui-monospace,SF Mono,Menlo,Consolas,monospace}.sim-trace,.sim-output,.sim-vars{background:var(--bg);border-radius:8px;padding:8px 10px;overflow-wrap:anywhere}.sim-output{max-height:220px;overflow-y:auto;white-space:pre-wrap}.sim-vars table{border-collapse:collapse;width:100%}.sim-vars td{padding:2px 0;vertical-align:top}.sim-vars td:first-child{color:var(--muted);padding-inline-end:12px;width:1%;white-space:nowrap}.sim-vars table.sim-grid{width:auto}.sim-vars .sim-grid td,.sim-vars .sim-grid td:first-child{border:1px solid var(--border);color:inherit;font-size:11px;padding:0 4px;text-align:center;width:auto}.sim-vars .sim-grid td.sim-grid-true{font-weight:700}.simpanel .placeholder{color:var(--muted);font:13px system-ui,-apple-system,sans-serif;margin:0}.sim-notice{margin:0 0 14px;padding:8px 10px;border-radius:8px;background:#34c75926;font-weight:600}.sim-edit{width:100%;margin:-6px 0 14px}.sim-notice.error{background:#ff3b3026;color:#b0000f}.sim-input.active{padding:8px 10px;margin-left:-10px;margin-right:-10px;border-radius:10px;background:#007aff14;outline:2px solid var(--accent)}.sim-prompt{margin:4px 0 6px;font-weight:600}.sim-input-row{display:flex;gap:6px}.sim-input-row input{flex:1;min-width:0;font:inherit;padding:6px 10px;border:1px solid var(--border);border-radius:8px}.sim-input-error{color:#b0000f;margin:6px 0 0;font-size:13px}@media(max-width:820px){.app.simulating{grid-template:"bar" auto "work" minmax(200px,1fr) "insp" auto "status" auto / minmax(0,1fr)}.simpanel{border-inline-start:none;border-top:1px solid var(--border);max-height:48vh}}.codepanel{display:none;grid-area:code;background:var(--panel);border-inline-start:1px solid var(--border);padding:12px;overflow-y:auto;min-height:0}.app.coding{grid-template:"bar bar bar" auto "pal work code" 1fr "pal insp code" auto "status status status" auto / 210px minmax(0,1fr) 400px}.app.coding .codepanel{display:block}.app.coding .inspector{max-height:34vh}button[data-action=code][aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft)}.code-head,.runner-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.code-close{min-height:28px;padding:2px 10px}.segmented{display:flex;margin-bottom:8px}.segmented button{flex:1;border-radius:0;min-height:30px;padding:4px 8px}.segmented button:first-child{border-radius:8px 0 0 8px}.segmented button:last-child{border-radius:0 8px 8px 0}.segmented button+button{border-inline-start:none}.segmented button[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:#fff}.segmented[hidden]{display:none}.check{display:flex;gap:8px;align-items:center;font-size:13px;margin-bottom:4px}.code-actions{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}.code-actions [hidden]{display:none}button.primary{background:var(--accent);border-color:var(--accent);color:#fff}.code-view,.runner-out{margin:0;padding:10px 12px;border-radius:10px;background:var(--bg);font:13px/1.5 ui-monospace,SF Mono,Menlo,Consolas,monospace;overflow:auto;white-space:pre;-moz-tab-size:4;tab-size:4}.runner{margin:12px 0}.runner-out{background:#0b1220;color:#e5e7eb;min-height:3em;max-height:240px;white-space:pre-wrap}.runner-out.error{outline:2px solid #ff453a}.runner-input{margin-top:8px}.runner-input label{display:block;font-weight:600;margin-bottom:4px}@media(max-width:820px){.app.coding{grid-template:"bar" auto "pal" auto "work" minmax(240px,1fr) "insp" auto "code" auto "status" auto / minmax(0,1fr)}.codepanel{border-inline-start:none;border-top:1px solid var(--border);max-height:50vh}}.tabs{display:flex;align-items:flex-end;gap:2px;padding:6px 8px 0;background:var(--bg);border-bottom:1px solid var(--border);overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}.tab{display:flex;align-items:center;max-width:220px;border:1px solid var(--border);border-bottom:none;border-radius:8px 8px 0 0;background:#ffffff80}.tab.active{background:var(--panel);margin-bottom:-1px;padding-bottom:1px}.tab button{border:none;background:none;min-height:30px;border-radius:8px 8px 0 0}.tab-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:4px 6px 4px 12px}.tab.active .tab-label{font-weight:600}.tab-close{padding:2px 8px;color:var(--muted);font-size:11px}.tab-close:hover{color:var(--text)}.tab-add{min-height:28px;padding:2px 10px;margin:0 0 3px 4px;border-radius:8px}.inspector .segmented{margin:6px 0 4px;max-width:420px}.mono-hint{font:11px/1.45 ui-monospace,SF Mono,Menlo,Consolas,monospace;overflow-wrap:anywhere}.editor-row{display:flex;gap:8px;align-items:flex-start}.editor-row textarea{flex:1;min-width:0}.fixed-prefix{font:14px ui-monospace,SF Mono,Menlo,Consolas,monospace;color:var(--muted);padding-top:9px}.inspector input:not([type]){width:100%;font:14px ui-monospace,SF Mono,Menlo,Consolas,monospace;padding:7px 8px;border:1px solid var(--border);border-radius:8px}.for-fields{display:grid;gap:4px}.for-fields label,.case-controls label{margin:4px 0 0;font-size:12px;color:var(--muted);font-weight:600}.case-controls{margin-top:12px;padding-top:10px;border-top:1px solid var(--border)}.case-controls .group{margin-top:8px}button.danger-text:not(:disabled){color:#d70015}.print-sheet{display:none}.learn{display:none;flex:none;width:400px;flex-direction:column;background:var(--panel);border-inline-end:1px solid var(--border);min-height:0}.shell.learning .learn{display:flex}.learn-resizer{display:none;flex:none;width:10px;margin-inline:-5px;z-index:5;cursor:col-resize;touch-action:none;position:relative}.shell.learning .learn-resizer{display:block}.learn-resizer:after{content:"";position:absolute;inset-block:0;inset-inline-start:4px;width:2px;background:transparent;transition:background .15s}.learn-resizer:hover:after,.learn-resizer:focus-visible:after,.shell.resizing .learn-resizer:after{background:var(--accent)}.learn-resizer:focus-visible{outline:none}.shell.resizing{cursor:col-resize;-webkit-user-select:none;user-select:none}.learn-head{display:flex;align-items:flex-start;gap:6px;margin:10px 12px 0}.learn-tabs{flex:1;min-width:0}.learn-hide{flex:none;min-height:30px;padding:4px 7px;display:inline-flex;align-items:center;color:var(--muted)}.learn-rail{flex:none;display:flex;flex-direction:column;align-items:center;gap:10px;width:36px;padding:10px 0;border:none;border-radius:0;border-inline-end:1px solid var(--border);background:var(--panel);cursor:pointer}.learn-rail:hover{background:var(--accent-soft)}.learn-rail span{writing-mode:vertical-rl;white-space:nowrap}.shell.learning .learn-rail:not(.live-rail){display:none}.live-rail{border-inline-end:none;border-inline-start:1px solid var(--border)}.live-rail svg{transform:scaleX(-1)}.shell.live .live-rail{display:none}.learn-body{overflow-y:auto;scrollbar-gutter:stable;padding:4px 16px 24px;flex:1;min-height:0;line-height:1.5}.learn-body h2.learn-title{font-size:20px;text-transform:none;letter-spacing:0;color:var(--text);margin:2px 0 10px}.learn-section{font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:18px 0 6px}.learn-list{list-style:none;padding:0;margin:0;display:grid;gap:6px}.learn-item{display:flex;align-items:center;gap:10px;width:100%;text-align:start;padding:8px 10px}.learn-item.done{border-color:#34c759}.learn-num{flex:none;min-width:28px;height:28px;border-radius:14px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font-weight:700;font-size:12px;padding:0 6px}.learn-item.done .learn-num{background:#34c7592e;color:#248a3d}.learn-item-text{flex:1;display:grid;min-width:0}.learn-item-text small{color:var(--muted)}.learn-status{flex:none;color:var(--muted);font-size:12px}.learn-item.done .learn-status{color:#248a3d;font-weight:700}.learn-back,.link-button{border:none;background:none;padding:6px 0;min-height:0;color:var(--accent)}.link-button{padding:0;text-align:start}.learn-kicker{margin:4px 0 0;color:var(--muted);font-size:12px}.learn-progress{display:flex;gap:4px;margin-bottom:14px}.learn-progress button{flex:1 1 0;min-width:0;padding:3px 0;font-size:13px;font-variant-numeric:tabular-nums;border-radius:6px}.learn-progress button.past{border-color:var(--accent);color:var(--accent)}.learn-progress button.current{border-color:var(--accent);background:var(--accent);color:#fff;font-weight:600}.learn-step-title{font-size:16px;margin:0 0 6px}.learn-text p,.learn-text ul,.learn-text ol{margin:0 0 10px}.learn-text ul,.learn-text ol{padding-inline-start:22px}.learn-text code,.learn-tests code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;background:var(--bg);border-radius:4px;padding:1px 4px}.learn-text h3{font-size:15px;margin:18px 0 4px}.lesson-code{background:var(--bg);border-radius:8px;padding:8px 10px;margin:0 0 10px;overflow-x:auto;overflow-y:hidden;font-size:12.5px}.lesson-code code{background:none;padding:0}.lesson-note{border-inline-start:3px solid var(--accent);background:var(--accent-soft);border-radius:6px;padding:8px 10px;margin:0 0 10px}.lesson-note p:last-child{margin-bottom:0}.learn-images{display:flex;gap:8px;flex-wrap:wrap}.learn-images img{width:150px;height:200px;object-fit:cover;border-radius:8px}.learn-brag{display:grid;grid-template-columns:48px 1fr;gap:10px;align-items:start;border:1px solid var(--border);border-radius:10px;padding:10px 12px;margin:0 0 14px;background:var(--accent-soft)}.learn-brag img{width:48px;height:48px;border-radius:50%}.learn-brag-title{margin:0 0 4px;font-weight:700}.learn-brag .learn-text p:last-child{margin-bottom:0}.learn-figure{margin:0 0 14px;display:grid;gap:6px;justify-items:start}.learn-preview{width:100%;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:#fafafa}.learn-preview>svg{display:block;width:100%;margin:0 auto;height:auto}.learn-figure figcaption{color:var(--muted);font-size:13px}.learn-exercise{border:1px solid var(--accent);border-radius:10px;padding:10px 12px;margin:0 0 14px;display:grid;gap:8px}.learn-exercise h4{margin:0;font-size:15px;display:flex;gap:8px;align-items:center}.learn-badge{font-size:12px;color:#248a3d;background:#34c7592e;border-radius:10px;padding:1px 8px}.learn-exercise .learn-text p:last-child{margin-bottom:0}.learn-result:empty{display:none}.learn-result{border-radius:8px;padding:8px 10px}.learn-result.ok{background:#34c75924}.learn-result.fail{background:#ff950024}.learn-result.info{background:var(--bg)}.learn-result-head{margin:0 0 6px;font-weight:600}.learn-tests{list-style:none;padding:0;margin:0;display:grid;gap:6px}.learn-test-detail{display:grid;padding-inline-start:16px;font-size:13px}.learn-error{color:#c4291c}.learn-solution summary{cursor:pointer;color:var(--accent)}.learn-solution[open]{display:grid;gap:6px;justify-items:start}.learn-checklist{list-style:none;padding:0;margin:0 0 14px;display:grid;gap:6px}.learn-checklist li{display:flex;gap:8px;align-items:baseline;justify-content:space-between}.learn-checklist label{display:flex;gap:8px;align-items:baseline}.learn-return{width:100%;margin:0 0 12px;border-color:var(--accent);background:var(--accent-soft)}.learn-nav+.learn-return{margin:12px 0 0}.learn-check-link{flex:none;font-size:13px}.learn-quiz fieldset{border:1px solid var(--border);border-radius:10px;padding:8px 12px 10px;margin:0 0 10px;display:grid;gap:6px}.learn-quiz legend{font-weight:600;padding:0 4px}.learn-option{text-align:start}.learn-option.right{border-color:#34c759;background:#34c75924}.learn-option.wrong{border-color:#ff3b30;background:#ff3b301a}.learn-match{display:grid;gap:6px}.learn-match-left{display:grid;grid-template-columns:8.5em minmax(0,1fr);align-items:center;gap:8px}.learn-match-select{min-width:0;width:100%;max-width:none}.learn-match-select.right{border-color:#34c759;background:#34c75924}.learn-match-select.wrong{border-color:#ff3b30;background:#ff3b301a}.learn-explanation{margin:0;color:var(--muted);font-size:13px}.learn-score{font-weight:600}.learn-nav{display:flex;justify-content:space-between;gap:8px;margin-top:18px}@media(max-width:1100px){.learn{width:340px}}@media(max-width:900px){.learn{width:300px}}.livecode{display:none;flex:none;width:420px;flex-direction:column;gap:6px;padding:10px 12px 12px;background:var(--panel);border-inline-start:1px solid var(--border);min-height:0}.shell.live .livecode{display:flex}.livecode-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px}.livecode-head h2{margin:0;font-size:16px}.livecode-head .segmented{margin:0 0 0 auto}.livecode-head .segmented button{min-height:28px;padding:2px 10px}.livecode .learn-hide svg{transform:scaleX(-1)}.livecode .hint{margin:0}.livecode-view{flex:1;min-height:0;padding:10px 0;font-size:14px}.livecode-view .ln{padding:0 12px;min-height:1.5em;border-inline-start:3px solid transparent}.livecode-view.selectable .ln{cursor:pointer}.livecode-view .ln.sel{background:var(--accent-soft);border-inline-start-color:var(--accent)}.livecode-view .ph{color:var(--muted);font-style:italic}.live-resizer{display:none;flex:none;width:10px;margin-inline:-5px;z-index:5;cursor:col-resize;touch-action:none;position:relative}.shell.live .live-resizer{display:block}.live-resizer:after{content:"";position:absolute;inset-block:0;inset-inline-start:4px;width:2px;background:transparent;transition:background .15s}.live-resizer:hover:after,.live-resizer:focus-visible:after,.shell.resizing .live-resizer:after{background:var(--accent)}.live-resizer:focus-visible{outline:none}@media(max-width:1100px){.livecode{width:340px}}@media(max-width:700px){.shell.learning .learn-resizer,.shell.live .live-resizer{display:none}.shell .learn,.shell .livecode{width:auto!important}.livecode{height:40vh;height:40dvh;border-inline-start:none;border-top:1px solid var(--border)}.learn-rail{flex-direction:row;justify-content:center;width:auto;padding:4px 0;border-inline-end:none;border-bottom:1px solid var(--border)}.learn-rail span{writing-mode:horizontal-tb}.live-rail{border-inline-start:none;border-bottom:none;border-top:1px solid var(--border)}.shell{flex-direction:column}.learn{width:auto;height:45vh;height:45dvh;border-inline-end:none;border-bottom:1px solid var(--border)}.shell>.app{flex:1;min-height:0}}@media print{@page{margin:12mm}body>*:not(.print-sheet){display:none!important}body{background:#fff!important}.print-sheet{display:block}.print-sheet svg{display:block;width:100%;height:auto;max-height:100vh}}.learn .term{text-decoration:underline dotted var(--accent);text-decoration-thickness:2px;text-underline-offset:3px;cursor:help;border-radius:3px}.learn .term:focus-visible,.learn .term[aria-expanded=true]{outline:none;background:var(--accent-soft)}.term-tip{position:fixed;z-index:1000;max-width:min(300px,calc(100vw - 16px));padding:8px 10px;background:var(--panel);color:var(--text);border:1px solid var(--border);border-radius:8px;box-shadow:0 4px 16px #0000002e;font-size:14px;line-height:1.4}.term-tip[hidden]{display:none}.learn .ui-pointer{color:var(--accent);font-weight:600;border-bottom:2px solid var(--accent-soft);cursor:pointer;border-radius:3px}.learn .ui-pointer:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.ui-spot{outline:3px solid var(--accent)!important;outline-offset:-3px;box-shadow:inset 0 0 0 9999px #007aff14;animation:ui-spot-pulse 1.2s ease-in-out infinite}@keyframes ui-spot-pulse{50%{outline-color:#007aff59}}@media(prefers-reduced-motion:reduce){.ui-spot{animation:none}}.learn-graphic{display:block;width:100%;max-width:440px;height:auto;margin:0 auto;border-radius:8px;border:1px solid var(--border)}.lesson-table{overflow-x:auto;margin:8px 0}.lesson-table table{border-collapse:collapse;font-size:13px;font-variant-numeric:tabular-nums}.lesson-table th,.lesson-table td{border:1px solid var(--border);padding:3px 8px;text-align:start;white-space:nowrap}.lesson-table th{background:var(--bg)}.learn-hints .lesson-note{margin-top:8px}.learn-teacher{margin-top:24px;border-top:1px solid var(--border);padding-top:12px}.learn-teacher summary{cursor:pointer;color:var(--muted)}.learn-teacher input{flex:1;min-width:0} diff --git a/website/app/assets/it-CQO8hRgc.js b/website/app/assets/it-DbDiZBco.js similarity index 97% rename from website/app/assets/it-CQO8hRgc.js rename to website/app/assets/it-DbDiZBco.js index 8646aa30..631d7787 100644 --- a/website/app/assets/it-CQO8hRgc.js +++ b/website/app/assets/it-DbDiZBco.js @@ -50,7 +50,6 @@ const e=`/* Testi presenti solo nella versione web. Tutto il resto proviene dai /* Code live */ "web_live_title" = "Codice dal vivo"; -"web_live_toggle_title" = "Mostra il codice dal vivo accanto al diagramma"; "web_live_hide" = "Nascondi codice dal vivo"; "web_live_show" = "Mostra codice dal vivo"; "web_live_resize" = "Modifica la larghezza dell’area codice (doppio clic: ripristina)"; diff --git a/website/app/assets/ja-La_WZu6k.js b/website/app/assets/ja-C3rHFfYH.js similarity index 98% rename from website/app/assets/ja-La_WZu6k.js rename to website/app/assets/ja-C3rHFfYH.js index 890ec6d9..41b66d70 100644 --- a/website/app/assets/ja-La_WZu6k.js +++ b/website/app/assets/ja-C3rHFfYH.js @@ -50,7 +50,6 @@ const e=`/* Web 版にのみ存在するテキスト。その他はすべてア /* Code live */ "web_live_title" = "ライブコード"; -"web_live_toggle_title" = "図の横にコードをライブ表示"; "web_live_hide" = "ライブコードを隠す"; "web_live_show" = "ライブコードを表示"; "web_live_resize" = "コード領域の幅を変更(ダブルクリック:リセット)"; diff --git a/website/app/assets/ko-DObNRxlY.js b/website/app/assets/ko-Co7zOA8X.js similarity index 97% rename from website/app/assets/ko-DObNRxlY.js rename to website/app/assets/ko-Co7zOA8X.js index 999a1adf..6b31dc94 100644 --- a/website/app/assets/ko-DObNRxlY.js +++ b/website/app/assets/ko-Co7zOA8X.js @@ -50,7 +50,6 @@ const e=`/* 웹 버전에만 있는 텍스트입니다. 나머지는 모두 앱 /* Code live */ "web_live_title" = "실시간 코드"; -"web_live_toggle_title" = "다이어그램 옆에 코드를 실시간으로 표시"; "web_live_hide" = "실시간 코드 숨기기"; "web_live_show" = "실시간 코드 표시"; "web_live_resize" = "코드 영역 너비 변경(더블클릭: 초기화)"; diff --git a/website/app/assets/nb-X4VbD4CE.js b/website/app/assets/nb-D7cbcu7D.js similarity index 97% rename from website/app/assets/nb-X4VbD4CE.js rename to website/app/assets/nb-D7cbcu7D.js index 948aa19d..a379f9f7 100644 --- a/website/app/assets/nb-X4VbD4CE.js +++ b/website/app/assets/nb-D7cbcu7D.js @@ -50,7 +50,6 @@ const e=`/* Tekster som bare finnes i nettversjonen. Alt annet kommer fra appens /* Code live */ "web_live_title" = "Live-kode"; -"web_live_toggle_title" = "Vis kode live ved siden av diagrammet"; "web_live_hide" = "Skjul live-kode"; "web_live_show" = "Vis live-kode"; "web_live_resize" = "Endre bredden på kodeområdet (dobbeltklikk: tilbakestill)"; diff --git a/website/app/assets/nl-CdeYgYYf.js b/website/app/assets/nl-Dq2LX98h.js similarity index 98% rename from website/app/assets/nl-CdeYgYYf.js rename to website/app/assets/nl-Dq2LX98h.js index de294700..3208a0ed 100644 --- a/website/app/assets/nl-CdeYgYYf.js +++ b/website/app/assets/nl-Dq2LX98h.js @@ -50,7 +50,6 @@ const e=`/* Teksten die alleen in de webversie bestaan. Al het andere komt uit d /* Code live */ "web_live_title" = "Live code"; -"web_live_toggle_title" = "Code live naast het diagram tonen"; "web_live_hide" = "Live code verbergen"; "web_live_show" = "Live code tonen"; "web_live_resize" = "Breedte van het codegebied wijzigen (dubbelklik: herstellen)"; diff --git a/website/app/assets/pl-Jtu3L1c4.js b/website/app/assets/pl-AtW6u2Bg.js similarity index 98% rename from website/app/assets/pl-Jtu3L1c4.js rename to website/app/assets/pl-AtW6u2Bg.js index e4ca8b7a..f58115b2 100644 --- a/website/app/assets/pl-Jtu3L1c4.js +++ b/website/app/assets/pl-AtW6u2Bg.js @@ -50,7 +50,6 @@ const e=`/* Teksty dostępne tylko w wersji webowej. Wszystko inne pochodzi z pl /* Code live */ "web_live_title" = "Kod na żywo"; -"web_live_toggle_title" = "Pokaż kod na żywo obok diagramu"; "web_live_hide" = "Ukryj kod na żywo"; "web_live_show" = "Pokaż kod na żywo"; "web_live_resize" = "Zmień szerokość obszaru kodu (dwuklik: resetuj)"; diff --git a/website/app/assets/pt-PT-BKaCFzc4.js b/website/app/assets/pt-PT-DsE2Zies.js similarity index 97% rename from website/app/assets/pt-PT-BKaCFzc4.js rename to website/app/assets/pt-PT-DsE2Zies.js index e4d292c5..fa2ce93f 100644 --- a/website/app/assets/pt-PT-BKaCFzc4.js +++ b/website/app/assets/pt-PT-DsE2Zies.js @@ -43,7 +43,6 @@ const e=`/* Textos que só existem na versão web. Tudo o resto vem dos Localiza "web_run_error" = "Erro durante a execução."; "web_run_dropped_fmt" = "… %d linhas anteriores ocultas"; "web_learn_title" = "Aprender"; -"web_learn_toggle_title" = "Mostrar ou ocultar lições, exercícios e consulta"; "web_learn_hide" = "Recolher a área de aprendizagem"; "web_learn_show" = "Expandir a área de aprendizagem: lições, exercícios e consulta"; "web_learn_lessons" = "Lições"; @@ -106,7 +105,6 @@ const e=`/* Textos que só existem na versão web. Tudo o resto vem dos Localiza /* Code live */ "web_live_title" = "Código ao vivo"; -"web_live_toggle_title" = "Mostrar o código ao vivo ao lado do diagrama"; "web_live_hide" = "Ocultar código ao vivo"; "web_live_show" = "Mostrar código ao vivo"; "web_live_resize" = "Alterar a largura da área de código (duplo clique: repor)"; diff --git a/website/app/assets/ru-CvjW0r5W.js b/website/app/assets/ru-S-OGDMjr.js similarity index 97% rename from website/app/assets/ru-CvjW0r5W.js rename to website/app/assets/ru-S-OGDMjr.js index 8ddaed95..276e6560 100644 --- a/website/app/assets/ru-CvjW0r5W.js +++ b/website/app/assets/ru-S-OGDMjr.js @@ -50,7 +50,6 @@ const e=`/* Тексты, которые есть только в веб-вер /* Code live */ "web_live_title" = "Код вживую"; -"web_live_toggle_title" = "Показывать код вживую рядом с диаграммой"; "web_live_hide" = "Скрыть код вживую"; "web_live_show" = "Показать код вживую"; "web_live_resize" = "Изменить ширину области кода (двойной щелчок: сбросить)"; diff --git a/website/app/assets/sv-29L8cFQi.js b/website/app/assets/sv-BgYrXVSc.js similarity index 98% rename from website/app/assets/sv-29L8cFQi.js rename to website/app/assets/sv-BgYrXVSc.js index 086465a5..99f67a63 100644 --- a/website/app/assets/sv-29L8cFQi.js +++ b/website/app/assets/sv-BgYrXVSc.js @@ -50,7 +50,6 @@ const e=`/* Texter som bara finns i webbversionen. Allt annat kommer från appen /* Code live */ "web_live_title" = "Live-kod"; -"web_live_toggle_title" = "Visa kod live bredvid diagrammet"; "web_live_hide" = "Dölj live-kod"; "web_live_show" = "Visa live-kod"; "web_live_resize" = "Ändra kodområdets bredd (dubbelklick: återställ)"; diff --git a/website/app/assets/tr-MtsbQ98M.js b/website/app/assets/tr-CrrRFe4L.js similarity index 97% rename from website/app/assets/tr-MtsbQ98M.js rename to website/app/assets/tr-CrrRFe4L.js index 4429d49f..755b232e 100644 --- a/website/app/assets/tr-MtsbQ98M.js +++ b/website/app/assets/tr-CrrRFe4L.js @@ -50,7 +50,6 @@ const e=`/* Yalnızca web sürümünde bulunan metinler. Geri kalan her şey uyg /* Code live */ "web_live_title" = "Canlı kod"; -"web_live_toggle_title" = "Kodu diyagramın yanında canlı göster"; "web_live_hide" = "Canlı kodu gizle"; "web_live_show" = "Canlı kodu göster"; "web_live_resize" = "Kod alanının genişliğini değiştir (çift tıklama: sıfırla)"; diff --git a/website/app/assets/uk-BeltaX1a.js b/website/app/assets/uk-CWUyWuF5.js similarity index 97% rename from website/app/assets/uk-BeltaX1a.js rename to website/app/assets/uk-CWUyWuF5.js index 289f1875..b33593c5 100644 --- a/website/app/assets/uk-BeltaX1a.js +++ b/website/app/assets/uk-CWUyWuF5.js @@ -50,7 +50,6 @@ const e=`/* Тексти, які є лише у веб-версії. Усі ін /* Code live */ "web_live_title" = "Код наживо"; -"web_live_toggle_title" = "Показувати код наживо поруч із діаграмою"; "web_live_hide" = "Сховати код наживо"; "web_live_show" = "Показати код наживо"; "web_live_resize" = "Змінити ширину області коду (подвійний клік: скинути)"; diff --git a/website/app/assets/zh-Hans-B4JA_Azf.js b/website/app/assets/zh-Hans-DxaX4UOg.js similarity index 98% rename from website/app/assets/zh-Hans-B4JA_Azf.js rename to website/app/assets/zh-Hans-DxaX4UOg.js index b9c311cc..47d0ca5a 100644 --- a/website/app/assets/zh-Hans-B4JA_Azf.js +++ b/website/app/assets/zh-Hans-DxaX4UOg.js @@ -50,7 +50,6 @@ const e=`/* 仅存在于网页版中的文本。其他所有文本均来自应 /* Code live */ "web_live_title" = "实时代码"; -"web_live_toggle_title" = "在图旁实时显示代码"; "web_live_hide" = "隐藏实时代码"; "web_live_show" = "显示实时代码"; "web_live_resize" = "更改代码区宽度(双击:重置)"; diff --git a/website/app/assets/zh-Hant-Cv-_Uw4T.js b/website/app/assets/zh-Hant-DTRor7O5.js similarity index 98% rename from website/app/assets/zh-Hant-Cv-_Uw4T.js rename to website/app/assets/zh-Hant-DTRor7O5.js index 560caf8e..9c9c749e 100644 --- a/website/app/assets/zh-Hant-Cv-_Uw4T.js +++ b/website/app/assets/zh-Hant-DTRor7O5.js @@ -50,7 +50,6 @@ const e=`/* 僅存在於網頁版的文字。其他所有文字皆來自 App 的 /* Code live */ "web_live_title" = "即時程式碼"; -"web_live_toggle_title" = "在圖旁即時顯示程式碼"; "web_live_hide" = "隱藏即時程式碼"; "web_live_show" = "顯示即時程式碼"; "web_live_resize" = "變更程式碼區寬度(按兩下:重設)"; diff --git a/website/app/index.html b/website/app/index.html index cc78f045..b5cbf38b 100644 --- a/website/app/index.html +++ b/website/app/index.html @@ -6,8 +6,8 @@ VisuStruct Web - - + +